An elevated number of women of reproductive age are overweight, predisposing their offspring to metabolic and neuropsychiatric disorders. Gut microbiota is influenced by maternal factors, and has been implicated in the pathogenesis of neurodegenerative diseases. Our aim was to explore the effects of maternal high-fat feeding on the relationship linking gut microbiota and cognitive development in the offspring. Murine offspring born to dams undergoing normal diet (NDm) and high-fat diet (HFDm) were studied at 1 or 6 months of age to assess cognitive function by Y-maze test, cerebral glucose metabolism and insulin sensitivity by Positron Emission Tomography, brain density by Computed Tomography, microbiota profile (colon, caecum) and inferred metabolic pathways (KEGG analysis) by 16S ribosomal RNA sequencing. From 3 weeks post-weaning, mice born to HFDm developed hyperphagia and overweight, showing reduction in memory and exploratory behaviour, and brain insulin resistance in adulthood. We identified a panel of bacteria characterizing offspring born to HFD dams from early life, and correlating with dysfunction in memory and exploratory behaviour in adults (including Proteobacteria phylum, Parabacteroides and unclassified Rikenellaceae genera). Microbiota-derived metabolic pathways involved in fatty acid, essential aminoacid and vitamin processing, sulphur metabolism, glutaminergic activation and Alzheimer's disease were differently present in the HFDm and NDm offspring groups. Our results document tight relationships between gut dysbiosis and memory and behavioural impairment in relation to maternal HFD. Persistent bacterial signatures induced by maternal HFD during infancy can influence cognition during adulthood, opening the possibility of microbiota-targeted strategies to contrast cognitive decline.