Objective To explore the effect of pharyngeal swab nucleic acid detection and serum mycoplasma antibody detection in the diagnosis of mycoplasma pneumoniae pneumonia.Methods: 3702 children with suspected mycoplasma pneumoniae infection were selected from our hospital from August 2020 to July 2022.They were divided into two groups according to the time of onset.1876 cases in Group A had an onset of less than 7 days, and 1826 cases in Group B had an onset of more than 7 days.Both groups were tested with Mycoplasma pharyngeal swab nucleic acid and Mycoplasma MP-IgM, and the positive detection rates were compared.Results: In group A (duration<7 days), the positive rate of mycoplasma pharyngeal swab nucleic acid detection (27.29%) was significantly higher than that of mycoplasma MP-IgM detection (12.87%) (P<0.05).In group B (the course of disease ≥ 7 days), the positive rate of mycoplasma pharyngeal swab nucleic acid detection was 30.89%, and the positive rate of mycoplasma MP-IgM detection was 29.08%, with no significant difference (P>0.05).Conclusion: The nucleic acid detection method of pharyngeal swab is simple, non-invasive, and the positive detection rate of early diagnosis is higher, which is worthy of clinical reference.