To meet the control requirements of high precision and high robustness for peg-in-hole assembly tasks, an optimized control method for a peg-in-hole assembly task of a space manipulator is proposed to reduce the system disturbance caused by the change contact status during the assembly process. The first step is to build an equivalent stiffness model, which considers the structure and control characteristics of the space manipulator. Flexibility indices along the assembly direction are then created. On completion of the flexibility indices, the assembly configuration of the manipulator is optimized with the gain of the joint controller. After that, based on the sliding mode impedance control law, the disturbance of contact force is compensated using a zero-sum optimal control compensation strategy. Finally, the correctness and effectiveness of the control method are verified through simulation experiments. The results of the simulation experiments show that the contact force of the space manipulator can be precisely controlled by the method proposed in this paper. Compared with existing methods, the sudden change of contact force and the disturbing force of the base are reduced by 90% and 54%, respectively. A control method of the space manipulator for a peg-in-hole assembly task considering the equivalent stiffness optimization is proposed, which effectively reduces the influence of disturbance caused by contact collision and improves the control robustness of peg-in-hole assembly tasks.