BackgroundThe incidence of tonsillopharyngitis is especially prevalent in children. Despite the fact that viruses cause the majority of infections, antibiotics are frequently used as a treatment, contrary to international guidelines. This is not only an inappropriate method of treatment for viral infections, but it also significantly contributes to the emergence of antibiotic-resistant strains. In this study, EBV and CMV-related tonsillopharyngitis were distinguished from other pathogens by using machine learning techniques to construct a classification tree based on clinical characteristics.Materials and methodsIn 2016 and 2017, we assessed information regarding 242 children with tonsillopharyngitis. Patients were categorized according to whether acute cytomegalovirus or Epstein-Barr virus infections were confirmed (n = 91) or not (n = 151). Based on symptoms and blood test parameters, we constructed decision trees to discriminate the two groups. The classification efficiency of the model was characterized by its sensitivity, specificity, positive predictive value, and negative predictive value. Fisher’s exact and Welch’s tests were used to perform univariable statistical analyses.ResultsThe best decision tree distinguished EBV/CMV infection from non-EBV/CMV group with 83.33% positive predictive value, 88.90% sensitivity and 90.30% specificity. GPT (U/l) was found to be the most discriminatory variable (p <0.0001). Using the model, unnecessary antibiotic treatment could be reduced by 66.66% (p = 0.0002).DiscussionOur classification model can be used as a diagnostic decision support tool to distinguish EBC/CMV infection from non EBV/CMV tonsillopharyngitis, thereby significantly reducing the overuse of antibiotics. It is hoped that the model may become a tool worth considering in routine clinical practice and may be developed to differentiate between viral and bacterial infections.Supplementary InformationThe online version contains supplementary material available at 10.1186/s12887-023-04103-0.