Considering the current low level of mechanization for domestic green onion planting and the high labor intensity of artificial planting, a 2ZYX-2 green onion ditching and transplanting machine, which can complete ditching, ridging, transplanting, repression, soil covering and other operations, is designed in this study. The Central Composite test design method was carried out with the speed of the transplanting machine, the depth of the opener and the horizontal position of the opener as the experimental factors and with the qualification ratio of perpendicularity, the variation coefficient of the plant spacing and the qualification ratio of the planting depth as the test index. Through the analysis of the model interaction and response surface, the change laws that the influence the machine's forward speed, the depth of the opener and the horizontal position of the opener were studied. The regression model was optimized by Design-Expert 8.0.6 software, and the accuracy of the predicted results was verified by experiments. The optimal working parameters showed that the forward speed of the machine was 0.06 m/s, the depth of the opener was 102 mm, and the horizontal position of the opener was 29 mm. Under conditions of optimal working parameters, the qualification rate of the verticality was 86.83%, the coefficient of variation for the plant spacing was 2.77, and the pass rate of planting depth was 88.26%. The research related to the thesis can provide a reference for the mechanized planting of green onion, which is of great significance to the cost-effectiveness of the green onion industry.