Rodents, including the striped field mouse (Apodemus agrarius), play vital roles in ecosystem functioning, with their gut microbiota contributing significantly to various ecological processes. Here, we investigated the structure and function of 94 wild A. agrarius individuals from 7 geographic populations (45°57′ N, 126°48′ E; 45°87′ N, 126°37′ E; 45°50′ N, 125°31′ E; 45°59′ N, 124°37′ E; 46°01′ N, 124°88′ E; 46°01′ N, 124°88′ E; 46°01′ N, 124°88′ E), revealing two distinct enterotypes (Type1 and Type2) for the first time. Each enterotype showed unique microbial diversity, functions, and assembly processes. Firmicutes and Bacteroidetes dominated, with a significant presence of Lactobacillus and Muribaculaceae. Functional analysis highlighted metabolic differences, with Type1 emphasizing nutrient processing and Type2 showing higher energy production capacity. The analysis of the neutral model and the null model revealed a mix of stochastic (drift and homogenizing dispersal) and deterministic processes (homogenous selection) that shape the assembly of the microbiota, with subtle differences in the assembly processes between the two enterotypes. Correlation analysis showed that elevation and BMI were associated with the phylogenetic turnover of microbial communities, suggesting that variations in these factors may influence the composition and diversity of the gut microbiota in A. agrarius. Our study sheds light on gut microbial dynamics in wild A. agrarius populations, highlighting the importance of considering ecological and physiological factors in understanding host–microbiota interactions.