Fetal macrosomia is defined as a birthweight ≥4000 g and causes harm to pregnant women and fetuses. Studies reported that the maternal intestinal microbiome plays a key role in the establishment, growth, and development of the fetal intestinal microbiome. However, whether there is a relationship between maternal gut microbiota and macrosomia remains unclear. Our study aimed to identify gut microbiota that may be related to the occurrence of macrosomia, explore the possible mechanisms by which it causes macrosomia, and establish a prediction model to determine the feasibility of predicting macrosomia by early maternal gut microbiota. We conducted a nested case-control study based on an early pregnancy cohort (ChiCTR1900020652) in the Maternity and Child Health Hospital of Hunan Province on fecal samples of 93 women (31 delivered macrosomia as the case group and 62 delivered normal birth weight newborns as the control group) collected and included in this study. We performed metagenomic analysis to compare the composition and function of the gut microbiome between cases and controls. Correlation analysis was used to explore the association of differential species and differential functional pathways. A random forest model was used to construct an early pregnancy prediction model for macrosomia. At the species level, there were more Bacteroides salyersiae, Bacteroides plebeius, Ruminococcus lactaris, and Bacteroides ovatus in the intestinal microbiome of macrosomias' mothers compared with mothers bearing fetuses that had normal birth weight. Functional pathways of the gut microbiome including gondoate biosynthesis, L-histidine degradation III, cis-vaccenate biosynthesis, L-arginine biosynthesis III, tRNA processing, and mannitol cycle, which were more abundant in the macrosomia group. Significant correlations were found between species and functional pathways. Bacteroides plebeius was significantly associated with the pathway of cis-vaccenate biosynthesis (r = 0.28, p = 0.005) and gondoate biosynthesis (r = 0.28, p < 0.001) and Bacteroides ovatus was positively associated with the pathway of cis-vaccenate biosynthesis (r = 0.29, p = 0.005) and gondoate biosynthesis (r = 0.32, p = 0.002). Bacteroides salyersiae was significantly associated with the pathway of cis-vaccenate biosynthesis (r = 0.24, p = 0.018), gondoate biosynthesis (r = 0.31, p = 0.003), and L-histidine degradation III (r = 0.22, p = 0.291). Finally, four differential species and four clinical indicators were included in the random forest model for predicting macrosomia. The areas under the working characteristic curves of the training and validation sets were 0.935 (95% CI: 0.851~0.979) and 0.909 (95% CI: 0.679~0.992), respectively. Maternal gut microbiota in early pregnancy may play an important role in the development of macrosomia and can be used as potential predictors to prevent macrosomia.