Assessing learning and memory has become critical to evaluate brain function in health, aging or neurological disease. The hippocampus is crucially involved in these processes as illustrated by H.M.'s remarkable case and by the well-established early symptoms of Alzheimer's disease. Numerous studies have reported the impact of gut microbiota on hippocampal structure and function using pro-, pre- and antibiotics, diet manipulations, germ-free conditions or fecal transfer. However, most diet manipulations have relied on Western diet paradigms (high fat, high energy, high carbohydrates). Here, we compared the impact of two standard diets, 5K52 and 2918 (6% fat, 18% protein, 3.1kcal/g), and how they influenced hippocampal learning and memory in adult 6-month-old congenic C57BL/6J mice from two sources. Using a hippocampal-dependent task, we found that 5K52-fed mice performed consistently better than 2918-fed animals in the Barnes circular maze. These behavioral differences were accompanied with marked changes in microbiota, which correlated with spatial memory retention performance. We next tested whether 2918-induced alterations in behavior and microbiome could be rescued by 5K52 diet for 3 months. Changing the 2918 diet to 5K52 diet mid-life improved spatial learning and memory in mice. Shotgun sequencing and principal component analyses revealed significant differences at both phylum and species levels. Multivariate analyses identified Akkermansia muciniphila or Bacteroidales bacterium M11 and Faecalibaculum rodentium as the strongest correlates to spatial memory retention in mice depending on the animal source. In both settings, the observed behavioral differences only affected hippocampal-dependent performance as mice fed with either diet did similarly well on the non-spatial variant of the Y-maze. In summary, these findings demonstrate the diverging effects of seemingly equivalent standard diets on hippocampal memory. Based on these results, we strongly recommend the mandatory inclusion of the diet and source of animals used in rodent behavioral studies.