The influence of gut microbiota on gut health is well-documented, but it remains obscure for extraintestinal diseases such as breast cancer. Moreover, it is entirely unknown how gut dysbiosis during early life contributes to breast tumorigenesis later in life. In this study, we hypothesized that a high-fat diet during early life leads to alterations in the gut microbiome and is associated with disruptions in the mammary microenvironment. Female C57BL/6 mice were fed a low-fat diet (10% kcal fat) or a high-fat diet (HF, 60% kcal fat) for 8 weeks from the age of 4 to 12 weeks, which is equivalent to human childhood and adolescence. Twelve mice were sacrificed immediately after the 8-week feeding, the remainder were euthanized after switching to a normal lifecycle-supporting diet for an additional 12 weeks; the gut microbiome was then sequenced. The 8-week HF diet feeding altered the beta-diversity (Bray & Jaccard P < .01), and the difference remained significant after switching the diet (Bray & Jaccard P < .05). Immediately after HF feeding, a greater number of microbial taxa (>50) were altered, and about half of the taxa (25) remained significantly changed after switching the diet. The abundance of Alistipes, Bilophila, and Rikenellaceae stood out as significantly associated with multiple metabolic and inflammatory biomarkers in mammary tissue, including aromatase, Ccl2, and Cox2. In conclusion, an 8-week early-life HF feeding reshaped the gut microbiome, which connected with disrupted mammary microenvironments.