Introduction Gut microbiota reportedly play a critical role in some autoimmune diseases by maintaining immune homeostasis. Only a few studies have examined the correlation between gut microbiota and the onset of primary immune thrombocytopenia (ITP), especially in children. The purpose of this study was to investigate changes in the composition and diversity of the fecal microbiota of children with ITP, as well as the correlation between such microbiota and the onset of ITP.Methods Twenty-five children newly diagnosed with ITP and 16 healthy volunteers (controls) were selected for the study. Fresh stool samples were collected to identify changes in the composition and diversity of gut microbiota as well as for potential correlation analysis.Results In ITP patients, the phyla that were most frequently encountered were Firmicutes (54.3%), followed by Actinobacteria (19.79%), Bacteriodetes (16.06%), and Proteobacteria (8.75%). The phyla that were predominantly found in the controls were, Firmicutes (45.84%), Actinobacteria (40.15%), Bacteriodetes (3.42%), and Proteobacteria (10.23%). Compared with those of the controls, the proportions of Firmicutes and Bacteriodetes in the gut microbiota of ITP patients were increased while the proportions of Actinobacteria and Proteobacteria were decreased. Furthermore, gut microbiota in ITP patients varied by age group, showed specific changes in diversity, and were correlated with antiplatelet antibodies. IgG levels were significantly positively correlated with Bacteroides (P<0.01).Conclusions The gut microbiota of children with ITP are imbalanced, as shown by the increase in Bacteroidetes, which was positively correlated with IgG. Thus gut microbiota may contribute to ITP pathogenesis via IgG.Clinical Trial Registration The clinical trial were registered and approved by the Institutional Review Committee of The Affiliated Huaian No.1 People’s Hospital of Nanjing Medical University. Ethics number KY-2023-106-01.