Most previous studies on Clostridium difficile infection (CDI) mainly focused on adults with underlying diseases or critical illnesses. However, the number of CDI cases in children has also significantly increased, especially the growth of community-acquired CDI, which has attracted attention. This study was conducted to examine the toxin gene characteristics and the risk factors associated with community-acquired CDI (CA-CDI) in children with diarrhea. Children with diarrhea before admission or within 48 hours of hospitalization were included in the study. Stool samples were collected from children with community-acquired diarrhea who were treated at the Children's Hospital of the First People's Hospital of Chenzhou, China from June of 2021 to June of 2022. Fluorescence real-time polymerase chain reaction was utilized to detect Clostridioides difficile (CD) toxins A (tcdA) and B (tcdB) genes as well as binary toxin gene A (cdtA) and B (cdtB) in the specimens cultured for CD. Each child with CA-CDI was matched with four control children of the same sex, age, and place of residence. Necessary clinical data were extracted from the hospital's electronic medical record system. Then, a multivariate conditional logistic regression analysis was applied to identify potential risk factors for CA-CDI. Sixteen (8.3%) of the 193 stool specimens who tested positive for CD were selected for the case group, and their matching 64 control patients were in the study cohort. The breakdown of the CD genotypes of the 16 positive cases were follows: 14 (tcdA+ and tcdB+) (7.25%) and 2 (tcdA+ and tcdB-) (1.04%). The cdtA and cdtB binary toxin genes were negative in all. The results of multivariate conditional logistic regression analysis identified antibiotic use within the previous month [odds ratio (OR) =5.13; 95% confidence interval (CI): 1.65-15.91] and non-breastfeeding (OR =4.89; 95% CI: 1.11-21.53) as independent risk factors for CDI in pediatric patients experiencing community-acquired diarrhea. Children who had been treated with antibiotics and not breastfed were more susceptible to CDI. Therefore, in order to prevent and to control the spread of CD infection, being prudent to the aforementioned high-risk factors is strongly advocated in clinical practice.