Four ecological processes mediate microbial diversity: selection, whereby host factors favour the persistence of particular microbial taxa; historical contingency, where differences in the timing and order of microbial acquisition results in different communities; stochastic factors that impact community assemblages; and dispersal limitation, where the presence of particular taxa is restricted by host population structure and local environmental factors. However, few studies have explored the impact of selection through diet modification on the differences in microbial community composition arising from dispersal limitation. At weaning, the faecal microbiota of 45 rats originating from six litters, as assessed by 16S rRNA gene sequencing, was strongly correlated with an animal's litter membership. Following 14 weeks on one of three the experimental diets, the faecal microbiota of the rats were again characterized. Clear effects of diet on microbial community composition were observed. However, after 14 weeks of dietary intervention, the effect of litter membership on microbial community composition was still significant. Our results demonstrate that intense selection (diet manipulation) cannot completely eliminate differences in microbial communities that occurred as a consequence of dispersal limitation (litter membership) prior to selection. These results have clear implications for efforts that attempt to achieve positive health outcomes through diet manipulation.