Trees, as foundation species, play a pivotal role in the species interaction networks that constitute forest ecosystems. From the seed stage, they interact with microbial communities that affect their growth, health and fitness. Despite their eco-evolutionary importance, the processes shaping seed microbial communities in natural forests have received little attention.• To unravel these processes, we analyzed the microbial communities of seeds collected in populations of sessile oak (Quercus petraea) growing along elevation gradients. We focused on the fungal communities as this group includes seed pathogens. Ecological processes shaping the communities were quantified using joint species distribution models.• Fungi were present in all seed tissues, including the embryo. Fungal communities differed significantly among oak populations along the elevation gradients, and among mother trees within the same population. These maternal effects remained significant after seed fall, despite colonization by fungal species on the ground. Associations between tree pathogens and their antagonists were detected in the seeds.• Our results demonstrate that both maternal effects and environmental filtering shape seed microbial communities of sessile oak. They provide a starting point for future research aimed at identifying the seed extended phenotypic traits that influence seed dispersal and germination, and seedling survival and growth across environments.