Background Patients with ulcerative colitis (UC) are at increased risk of Clostridioides difficile infection (CDI), which is the principal causative agent of nosocomial diarrhoea in western countries. This has been related to complications such as need of colectomy and mortality among these patients. The aim of this study was to assess the incidence and impact of CDI in patients hospitalised with UC. Methods Case–control retrospective study including patients admitted due to a UC flare from January 2000 to September 2018. Porpensity score matching (PSM) was performed to minimise selection bias taking into account the small number of cases compared to controls. Results 339 patients were included; CDI in 35 (10.3%) patients. After PSM, 35 (33.33%) cases and 70 (66.67%) controls were analysed. Patients with CDI presented higher rates of readmission (52.9% vs. 21.4%, p = .001), increased mortality within the first 3 months post-discharge (5.9% vs. 0%, p = .042) and increased need of therapy intensification in the first year after admission (20.7% vs. 12.5%, p = .001). No risk factors for CDI were identified. Multivariable cox regression showed that treatment with 5-aminosalycilates at baseline (HR 0.42, 95% CI 0.18–0.92) and albumin <3.5 g/dL (HR 3.11, 95% CI 1.21–8.03) were associated with worse outcomes. Conclusions CDI is a prevalent situation in hospitalised UC patients related to higher mortality within the first 3 months after the infection, need for therapy intensification within the first year and readmission. Our results underline the importance of CDI detection in patients with a flare of UC.