Excessive consumption of diets high in saturated fat and sugar impairs short-term spatial recognition memory in both humans and rodents. Several studies have identified associations between the observed behavioral phenotype and diet-induced changes in adiposity, hippocampal gene expression of inflammatory and blood-brain barrier-related markers, and gut microbiome composition. However, the causal role of such variables in producing cognitive impairments remains unclear. As intermittent cafeteria diet access produces an intermediate phenotype, we contrasted continuous and intermittent diet access to identify specific changes in hippocampal gene expression and microbial species that underlie the cognitive impairment observed in rats fed continuous cafeteria diet. Female adult rats were fed either regular chow, continuous cafeteria diet, or intermittent cafeteria diet cycles (4 days regular chow and 3 days cafeteria) for 7 weeks (12 rats per group). Any cafeteria diet exposure affected metabolic health, hippocampal gene expression, and gut microbiota, but only continuous access impaired short-term spatial recognition memory. Multiple regression identified an operational taxonomic unit, from species Muribaculum intestinale, as a significant predictor of performance in the novel place recognition task. Thus, contrasting intermittent and continuous cafeteria diet exposure allowed us to identify specific changes in microbial species abundance and growth as potential underlying mechanisms relevant to diet-induced cognitive impairment.