This paper presents an optimized preparation process for external ointment using the Definitive Screening Design (DSD) method. The ointment is a Traditional Chinese Medicine (TCM) formula developed by Professor WYH, a renowned TCM practitioner in Jiangsu Province, China, known for its proven clinical efficacy. In this study, a stepwise regression model was employed to analyze the relationship between key process factors (such as mixing speed and time) and rheological parameters. Machine learning techniques, including Monte Carlo simulation, decision tree analysis, and Gaussian process, were used for parameter optimization. Through rigorous experimentation and verification, we have successfully identified the optimal preparation process for WYH ointment. The optimized parameters included drug ratio of 24.5%, mixing time of 8 min, mixing speed of 1175 rpm, petroleum dosage of 79 g, liquid paraffin dosage of 6.7 g. The final ointment formulation was prepared using method B. This research not only contributes to the optimization of the WYH ointment preparation process but also provides valuable insights and practical guidance for designing the preparation processes of other TCM ointments. This advanced DSD method enhances the screening approach for identifying the best preparation process, thereby improving the scientific rigor and quality of TCM ointment preparation processes.