The authors study the process of decision-making optimization in the control of the spacecraft onboard systems. To ensure the continuous operation of a remotely controlled complex technical system, it is necessary, on the basis of an analysis of the state of the onboard systems, to formulate control effects, the absence of which could lead to the system's failure to fulfill its tasks or system failure. In order to prevent such situations, an approach based on a simulation model is proposed, the use of which will reduce the risk of accidents in the onboard systems of the spacecraft. The proposed model is represented by factor space. The state of the onboard parameters of the spacecraft at different points in time is matched by the set of points that form the decision-making surface in this factor space. The basic stages of forming the optimal trajectory on the decision surface, which are approximated by numerical methods, are given and described. Using the actual values of the parameters obtained in a 15-minute data communication session from the board of the artificial satellite Earth "Ocean-1", a decision-making surface was constructed. The equation of the optimal trajectory on the created surface is obtained. The simulation results will be used to develop emergency management and control systems.