The intestinal microbiome is a unique ecosystem and an essential mediator of metabolism and obesity in mammals. However, studies investigating the impact of the diet on the establishment of the gut microbiome early in life are generally lacking, and most notably so in primate models. Here we report that a high-fat maternal or postnatal diet, but not obesity per se, structures the offspring's intestinal microbiome in Macaca fuscata (Japanese macaque). The resultant microbial dysbiosis is only partially corrected by a low-fat, control diet after weaning. Unexpectedly, early exposure to a high-fat diet diminished the abundance of non-pathogenic Campylobacter in the juvenile gut, suggesting a potential role for dietary fat in shaping commensal microbial communities in primates. Our data challenge the concept of an obesity-causing gut microbiome and rather provide evidence for a contribution of the maternal diet in establishing the microbiota, which in turn affects intestinal maintenance of metabolic health.