A method is proposed for constructing a programmed trajectory in the problems of stabilizing a spacecraft in a fixed time. The method allows constructing a programmed motion, because of which the spacecraft is stabilized in rotational motion around the axis of dynamic symmetry, and this axis is oriented along the local vertical. The proposed algorithm is based on the possibility of representing the unit sphere of quaternions in four-dimensional space as a ball with a radius in three-dimensional space. This makes it possible to obtain a visual representation of the spacecraft rotation trajectory.