Obsessive–compulsive disorder (OCD) is a psychiatric illness that significantly impacts affected patients and available treatments yield suboptimal therapeutic response. Recently, the role of the gut–brain axis (GBA) in psychiatric illness has emerged as a potential target for therapeutic exploration. However, studies concerning the role of the GBA in OCD are limited. To investigate whether a naturally occurring obsessive–compulsive-like phenotype in a rodent model, that is large nest building in deer mice, is associated with perturbations in the gut microbiome, we investigated and characterised the gut microbiota in specific-pathogen-free bred and housed large (LNB) and normal (NNB) nest-building deer mice of both sexes (n = 11 per group, including three males and eight females). Following baseline characterisation of nest-building behaviour, a single faecal sample was collected from each animal and the gut microbiota analysed. Our results reveal the overall microbial composition of LNB animals to be distinctly different compared to controls (PERMANOVA p < .05). While no genera were found to be significantly differentially abundant after correcting for multiple comparisons, the normal phenotype showed a higher loading of Prevotella and Anaeroplasma, while the OC phenotype demonstrated a higher loading of Desulfovermiculus, Aestuariispira, Peptococcus and Holdemanella (cut-off threshold for loading at 0.2 in either the first or second component of the PCA). These findings not only provide proof-of-concept for continued investigation of the GBA in OCD, but also highlight a potential underlying aetiological association between alterations in the gut microbiota and the natural development of obsessive–compulsive-like behaviours.