Diet plays an important role in shaping gut microbiota. However, much remains to be learned regarding this association. We analyzed dietary intake and gut microbiota in a community-dwelling cohort of 441 Colombians. Diet quality, intake of food groups and nutrient consumption were paired with microbial diversity and composition using linear regressions, Procrustes analyses and a random-forest machine-learning algorithm. Analyses were adjusted for potential confounders, including the five cities from where the participants originated, sex (male, female), age group (18–40 and 41–62 years), BMI (lean, overweight, obese) and socioeconomic status. Microbial diversity was higher in individuals with increased intake of nutrients obtained from plant-food sources, whereas the intake of food groups and nutrients correlated with microbiota structure. Random-forest regressions identified microbial communities associated with different diet components. Two remarkable results confirmed previous expectations regarding the link between diet and microbiota: communities composed of short-chain fatty acid (SCFA) producers were more prevalent in the microbiota of individuals consuming diets rich in fiber and plant-food sources, such as fruits, vegetables and beans. In contrast, an inflammatory microbiota composed of bile-tolerant and putrefactive microorganisms along with opportunistic pathogens thrived in individuals consuming diets enriched in animal-food sources and of low quality, i.e., enriched in ultraprocessed foods and depleted in dietary fiber. This study expands our understanding of the relationship between dietary intake and gut microbiota. We provide evidence that diet is strongly associated with the gut microbial community and highlight generalizable connections between them.