Early gut microbiota development and colonization are crucial for the long-term health and performance of ruminants. However, cognition among these microbiota is still vague, particularly among the neonatal dairy calves. Here, extended-spectrum β-lactamase-producing enteroaggregative E. coli (ESBL-EAEC)-induced temporal changes in diversity, stability, and composition of gut microbiota were investigated among the neonatal female calves, with the view of discerning potential biomarkers of this arising diarrhea cases in local pastures. Nearly, 116 newborn calves were enrolled in this time period study during their first 2 weeks of life, and a total of 40 selected fecal samples from corresponding calves were used in this study. The results revealed that differentiated gut microbiome and metabolome discerned from neonatal calves were accompanied by bacterial infections over time. Commensal organisms like Butyricicoccus, Faecalibacterium, Ruminococcus, Collinsella, and Coriobacterium, as key microbial markers, mainly distinguish “healthy” and “diarrheic” gut microbiome. Random forest machine learning algorithm indicated that enriched fecal carbohydrates, including rhamnose and N-acetyl-D-glucosamine, and abundant short-chain fatty acids (SCFAs) existed in healthy ones. In addition, Spearman correlation results suggested that the presence of Butyricicoccus, Faecalibacterium, Collinsella, and Coriobacterium, key commensal bacteria of healthy calves, is positively related to high production of unabsorbed carbohydrates, SCFAs, and other prebiotics, and negatively correlated to increased concentrations of lactic acid, hippuric acid, and α-linolenic acid. Our data suggested that ESBL-EAEC-induced diarrhea in female calves could be forecasted by alterations in the gut microbiome and markedly changed unabsorbed carbohydrates in feces during early lives, which might be conducive to conduct early interventions to ameliorate clinical symptoms of diarrhea induced by the rising prevalence of ESBL-EAEC.