The intestinal mucosa is at the front line of host-microbiome interactions, but little is known about these interactions within natural populations. Here, we non-invasively investigated associations between the gut microbiome and mucosal immune measures while controlling for host, social, and ecological factors in 199 samples of 158 wild spotted hyenas (Crocuta crocuta) in the Serengeti National Park, Tanzania. We profiled the microbiome composition, including bacteria, fungi and parasites, using a multi-amplicon approach, and measured faecal immunoglobulin A and mucin. Probabilistic models indicated that both immune measures predict microbiome similarity among individuals in an age-dependent manner. The strength of the association effect varied, being strongest within bacteria, intermediate within parasites, and weakest within fungi communities. Machine learning regression accurately predicted both measures and identified the taxa driving these associations: symbiotic bacteria reported in humans and laboratory mice, unclassified bacteria, a hookworm, host DNA likely reflecting inflammation, and diet. Our findings indicate a complex interplay between the host, its environment and symbionts. These findings increase our knowledge of the gut microbiome in natural populations, which harbour highly dynamic and diverse eukaryotes under the influence of unpredictable environmental factors and where selection is not artificially biased.