Astroviruses (AstVs) infect numerous mammalian species including reservoirs such as bats. Peptides encoded by the genes of the highly polymorphic Major Histocompatibility Complex (MHC) form the first line of host defence against pathogens. Aside from direct involvement in mounting adaptive immune responses, MHC class II genes are hypothesized to regulate gut commensal diversity and shape the production of immune-modulatory substances by microbes, indirectly affecting host susceptibility. Despite initial empirical evidence for the link between host MHC and the microbiota, associations among these factors remain largely unknown. To fill this gap, we examined MHC allelic diversity and constitution, the gut bacterial community and abundance pattern of a wild population of a neotropical bat (Artibeus jamaicensis) challenged by AstV infections. First, we show an age-dependent relationship between the host MHC class II diversity and constitution and the gut microbiota in AstV-uninfected bats. Crucially, these associations changed in AstV-infected bats. Additionally, we identify changes in the abundance of specific bacterial taxa linked to the presence of certain MHC supertypes and AstV infection. We suggest changes in the microbiota to be either a result of AstV infection or the MHC-mediated modulation of microbial communities. The latter could subsequently affect microbemediated immunity and resistance against AstV infection. Our results emphasize that the reciprocal nature of host immune genetics, gut microbial diversity and pathogen infection require attention, which are particularly important given their repercussions for disease susceptibility and severity in wild animal populations with a history of zoonotic spillover and frequent human contact.