Alterations in the gut microbiome have been linked to obesity, with maternal high-fat diet (HF) playing a role in shaping offspring microbiome composition. However, the sex-specific responses to maternal HF diet and the impact of subsequent dietary challenges remain unclear. This study investigated the effects of maternal HF diet on offspring gut microbiota structure and predicted functional profile in response to short-term postnatal HF diet exposure with a focus on sex-specific responses. Female and male offspring of maternal control (C) diet or maternal HF diet were weaned onto C diet or HF diet. Offspring were euthanized at 13 weeks of age and cecal contents were collected for bacterial taxonomic profiling. Maternal HF diet reduced α-diversity, notably in male offspring weaned onto HF diet. Sex-specific differences were observed in the gut microbial composition and predicted functional potential. Furthermore, the influence of maternal diet on bacterial community structure and functional potential varied depending on postnatal diet. Maternal HF diet led to increased relative abundance of Corynebacterium in female offspring and decreased abundance of Akkermansia and Roseburia in male offspring. These findings underscore the sexually dimorphic nature of maternal HF diet effects on gut microbiota composition and function, with implications for developmental programming and metabolic health.