The rapid shift to high-grain (HG) diets in ruminants can affect the function of the rumen epithelium, but the dynamic changes in the composition of the epithelium-associated (epimural) bacterial community in sheep still needs further investigation. Twenty male lambs were randomly allocated to four groups (n = 5). Animals of the first group received hay diet and represented a control group (CON). Simultaneously, animals in the other three groups (HG groups) were rapidly shifted to an HG diet (60% concentrate)which continued for 7 (HG7), 14 (HG14) and 28 (HG28) days, correspondingly. Results showed that ruminal pH dramatically decreased due to the rapid shift to the HG diet (P <0.001), while, the concentrations of butyrate (P <0.001), lactate (P = 0.001), valerate (P = 0.008) and total volatile fatty acids (P = 0.001) increased. Diversity estimators showed a dramatic decrease after the shift without recovering as the HG feeding continued. The principal coordinates analysis showed that CON group clustered separately from all HG groups with the presence of significant difference only between HG7 and HG28 (P = 0.034). The non-parametric multivariate analysis (npmv R-package) deduced that the primary significant differences in phyla and phylogenetic investigation of communities by reconstruction of unobserved states (PICRUSt)-predicted Kyoto Encyclopedia of Genes and Genomes (KEGGs) was attributed mainly to the diet composition (P <0.001, P = 0.001) compared to its application period (P = 0.140, 0.545) which showed a significant effect only on the genus (P = 0.001) and the operational taxonomic units (OTUs) level (P = 0.011). The Kruskal–Wallis test deduced that six phyla showed a significant effect due to the shift in diet composition. At the genus level, HG feeding altered the abundance of 12 taxa, four of which showed a significant variation due to the duration of the HG diet application. Similarly, we found that 21 OTUs showed significant variations due to the duration of the HG diet application. Furthermore, the genes abundance predicted by PICRUSt revealed that the HG feeding significantly affected seven metabolic pathways identified in the KEGG. Particularly, the abundance of gene families associated with carbohydrates metabolism were significantly higher in HG feeding groups (P = 0.027). Collectively, these results revealed that the rapid transition to an HG diet causes dramatic alterations in ruminal fermentation and the composition and function of ruminal epithelium-associated microbiome in sheep, while, the duration of the HG diet application causes drastic alterations to the abundance of some species.