Clostridioides difficile infection (CDI) has been recognized as a leading cause of healthcare-associated infections and a considerable threat to public health globally. Increasing evidence suggests that the gut microbiota plays a key role in the pathogenesis of CDI. The taxonomic composition and functional capacity of the gut microbiota associated with CDI have not been studied systematically. Here, we performed a comprehensive shotgun metagenomic sequencing in a well-characterized human cohort to reveal distinct patterns of gut microbiota and potential functional features associated with CDI. Fecal samples were collected from 104 inpatients, including : (1) patients with clinically significant diarrhea and positive nucleic acid amplification testing (NAAT) and received CDI treatment (CDI, n = 47); (2) patients with positive stool NAAT but without diarrhea (Carrier, n = 17); (3) patients with negative stool NAAT but with diarrhea (Diarrhea, n = 14); and (4) patients with negative stool NAAT and without diarrhea (Control, n = 26). Downstream statistical analyses (including alpha and beta diversity analysis, differential abundance analysis, correlation network analysis, and potential functional analysis) were then performed. The gut microbiota in the Control group showed higher Chao1 index (p < 0.05), while Shannon index at KEGG module level was higher in CDI than in Carrier and Control (p < 0.05). Beta diversity for species composition differed significantly between CDI vs Carrier/Control cohorts (p < 0.05). Microbial Linear discriminant analysis Effect Size and ANCOM analysis both identified 8 species (unclassified_f_Enterobacteriaceae, Veillonella_parvula, unclassified_g_Klebsiella and etc.) were enriched in CDI, Enterobacter_aerogenes was enriched in Diarrhea, Collinsella_aerofaciens, Collinsella_sp_4_8_47FAA, Collinsella_tanakaei and Collinsella_sp_CAG_166 were enriched in Control (LDA >3.0, adjusted p < 0.05). Correlation network complexity was higher in CDI with more negative correlations than in other three cohorts. Modules involved in iron complex transport system (M00240) was enriched in CDI, ABC-2 type transport system (M00254), aminoacyl-tRNA biosynthesis (M00359), histidine biosynthesis (M00026) and inosine monophosphate biosynthesis (M00048) were enriched in Carrier, ribosome (M00178 and M00179) was enriched in Diarrhea, fluoroquinolone resistance (M00729) and aminoacyl-tRNA biosynthesis (M00360) were enriched in Control (LDA > 2.5, adjusted p < 0.05). Resistance functions of acriflavine and glycylcycline were enriched in CDI, while resistance function of bacitracin was enriched in Carrier (LDA > 3.0, adjusted p < 0.05), and the contributions of phylum and species to resistance functions differed among the four groups. Our results reveal alterations of gut microbiota composition and potential functions among four groups of differential colonization/infection status of Clostridioides difficile. These findings support the potential roles of gut microbiota and their potential functions in the pathogenesis of CDI.