This work aimed to explore anxiety-associated risk factors in patients diagnosed with ulcerative colitis (UC). Clinical data from patients diagnosed with UC and hospitalized at the First Affiliated Hospital of Xi'an Jiaotong University between May 2019 and June 2022 were retrospectively analyzed. A total of 260 patients were included and divided into UC with anxiety (n = 86) and UC without anxiety (n = 174) groups according to the Self-Rating Anxiety Scale score. The quality of life and disease activity in patients with UC were assessed using the Inflammatory Bowel Disease Questionnaire and Mayo Score, respectively. Clinical data, disease characteristics, quality of life, disease activity, and noise exposure were compared between the groups, and factors contributing to anxiety in patients with UC were explored through multivariate logistic regression analysis. No significant difference was found between the groups in terms of disease duration (P = 0.73), distribution of disease (P = 0.86), or medication use (P = 0.86). However, compared to UC patients without anxiety, those with anxiety were older (P < 0.05), predominantly female (P < 0.05), had lower quality of life (P < 0.05), experienced higher disease activity (P < 0.05), and had greater noise exposure (P < 0.05). The quality of life [odds ratio (OR) = 0.558, 95% confidence interval (CI) = 0.348-0.895, P = 0.02] was a protective factor for anxiety in patients with UC. Disease activity (OR = 1.680, 95% CI = 1.103-2.561, P = 0.02) and noise exposure (OR = 2.148, 95% CI = 1.084-4.106, P = 0.01) were significant risk factors for anxiety in patients with UC. Noise exposure and disease activity were associated with an increased risk of anxiety in patients with UC, whereas higher quality of life was protective against anxiety in UC patients.