Solution:
Let X and Y be the bottom and top point on ω (i.e., the tangents of X and Y to ω are parallel to BC, and Y and A lie on the same side of BC). Note that A, P, D, and X are collinear by homothety between the incircle and ω. The key claim is the following.
Claim 1. Line IY is tangent to ω.
Proof. Let the line through I parallel to BC meet AB and AC at B′, C′, respectively. Notice that B′L is the perpendicular bisector of BI, so B′L externally bisects ∠AB′C′. Similarly, C′L externally bisects ∠AC′B′. Hence, L is the excenter of △AB′C′, which means that B′C′ is tangent to ω. □

Now, we note that LY⊥BC, so L, Y, and M are collinear (on the perpendicular bisector of BC). Since ∠YPX=90∘ and ∠YMD=90∘, PDMY is cyclic. However, IYMD is a rectangle, so IPDMY is a cyclic pentagon. Hence, ∠IPM=∠IDM=90∘.