An algorithm is proposed for constructing the programmed rotation of a small spacecraft in an orbital coordinate system using flywheel motors for a fixed time. The considered method makes it possible to build program control of flywheel motors, as a result of which the spacecraft is stabilized in rotational motion around the axis of dynamic symmetry, and this axis is oriented along the local vertical. © 2023 American Institute of Physics Inc.. All rights reserved.