Objective. The study aimed to explore the efficacy of pulmonary surfactant (PS) combined with Mucosolvan in the diagnosis of meconium aspiration syndrome (MAS) in newborns through ultrasonic images of lung based on machine learning. Methods. 138 cases of infants with MAS were selected as the research subjects and randomly divided into PS group (n = 46), Mucosolvan group (n = 46), and combination group (n = 46). Then, ultrasonic images based on machine learning algorithm were used for examination. On the basis of conventional treatment, the PS group accepted intratracheal PS drip treatment with 100 mg/kg. For the Mucosolvan group, 7.5 mg/kg of Mucosolvan was added with 50 g/L glucose, which was diluted to 3 mL. Then, the mixture was injected intravenously with a micropump for more than 5 min. The combination group received combined treatment of PS and Mucosolvan. If there was no relief or the symptoms aggravated after 12 h of PS treatment, the patient should be treated again. 7.5 mg/kg/d of Mucosolvan was given for 7 days. Mechanical ventilation time, hospitalization time, oxygenation index (OI) before treatment, at 3 d and at 7 d after treatment, and arterial/alveolar oxygen ratio (a/APO2) of the three groups were detected and compared. Besides, in-hospital mortality and complication rate of the three groups were statistically compared. Results. Ultrasonic image edge detection based on machine learning algorithm was more condensed and better than Sobel operator. Compared with the PS group and the Mucosolvan group, treatment efficiency, OI at 3 d and at 7 d after treatment, and a/APO2 of combination group were increased. Mechanical ventilation time and hospitalization time of the combination group were shortened, and mortality rate of the combination group was reduced ( P < 0.05). Compared with the situation before treatment, OI at 3 d and at 7 d after treatment and a/APO2 of the combination group were increased, and OI at 7 d after treatment and a/APO2 of the PS group and the Mucosolvan group were increased ( P < 0.05). Curative effect, mechanical ventilation time, hospitalization time, OI before and after treatment, a/APO2, and mortality rate during hospitalization of the PS group and the Mucosolvan group had no significant difference ( P > 0.05). There was no significant difference in the complications rates in the three groups ( P > 0.05). Conclusion. Pulmonary ultrasound based on machine learning algorithm can be used in the diagnosis of MAS in neonates. PS combined with Mucosolvan is feasible and safe in treating neonatal MAS and effectively improves the pulmonary oxygenation function. Therefore, it is worthy of clinical application.