The surface area of the hyphersphere between $X$ and $X+\mathrm dX$ is $Y^{m-2}/Y\mathrm dX=Y^{m-3}\mathrm dX=(1-X^2)^{(m-3)/2}\mathrm dX$, where $Y=\sqrt{1-X^2}$ is the sine of the angle between $a$ and $b$. Up to normalization, this gives you the distribution of $X$. The normalization factor is the ratio of the surface area of a unit $(m-2)$-sphere and a unit $(m-1)$-sphere.
In particular, for $m=3$, the distribution is uniform. I don't know whether there's a name for it for $m\neq3$.
[Edit in response to the comment:] To get $Y^{m-2}/Y\mathrm dX$, it's easiest (at least for me) to think of the case of the $2$-sphere. Without loss of generality, let $a$ point along the positive $x$-axis, so the dot product is the $x$-coordinate of $b$. Then the dot product is constant on circles (in general: hyperspheres) orthogonal to the $x$ direction, and the sphere's surface is made up of small strips bounded by such circles. The surface area of the strip between $x$ and $\mathrm dx$ is the perimeter (in general: hypervolume) of the circle at $x$, which is proportional to $\sqrt{1-x^2}$ (in general: $\sqrt{1-x^2}^{m-2}$), times the width of the strip. The width of the strip is $\mathrm dx$ divided by the sine of the angle that the strip forms with the $x$ axis, which is $\sqrt{1-x^2}$, so the surface element is $\sqrt{1-x^2}^{m-3}\mathrm dx$.