The microbiome plays key roles in host physiology and ecology, but how the microbiome varies among populations of hosts is not well understood. However, different abiotic and biotic selection pressures across a species' range likely lead to variation in the microbiome. In addition, symbiotic microbiota may differ more between closely-related species in sympatry than in allopatry if selection favors the reduction of interspecific competition. We investigated variation in the maternally-transmitted, beneficial gut microbiomes of Phanaeus vindex and P. difformis, sister species of dung beetle that compete for the same resources in sympatry and occur across diverse climatic conditions. We sampled and sequenced bacterial/archaeal 16S rDNA from guts of P. difformis and P. vindex collected across 17 sympatric and allopatric sites. Gut microbial communities were best predicted by temperature and precipitation, cattle present at sites, and spatial relationships among sites. Contrary to our hypotheses, we did not find that the gut microbial communities of P. vindex and P. difformis differed more in sympatry than in allopatry, nor that P. vindex, the more broadly distributed of the two species, exhibited greater microbiome turnover among populations. However, the gut microbiome of P. vindex shifted more between sympatric and allopatric populations than did that of P. difformis, suggesting character displacement. While more research is needed, it is possible that differences in gut microbial communities allow P. vindex and P. difformis to partition their niches in sympatry. Our work argues for further exploration of the gut microbiome's potential role in niche partitioning and local adaptation.