Objective To investigate the prevalence of constipation among patients with chronic kidney disease (CKD) in Gansu province, and to analyze potential risk factors. Methods CKD patients in the Department of Nephrology and Dialysis Center & Clinical Medical School of the Second Hospital, Lanzhou University were surveyed by a constipation questionnaire developed according to the Rome III criteria during the two periods of July 2022 to August 2022, and January 2023 to February 2023 via the WJX platform. At the same time, demographics, hemodialysis-related data, laboratory parameters, and use of drugs such as iron and phosphorus binders were collected. Results Totally 279 adult CKD patients older than 18 years were enrolled, including 191 hemodialysis patients and 88 non-dialysis patients. The prevalence of constipation in CKD stage 1-2, 3-4, and 5 patients was 36.2%, 45.8%, and 29.8%, respectively. Univariate Logistic regression analysis showed that primary diabetic nephropathy (OR=4.694, 95% CI 1.436-15.350, P=0.011) was a significant risk factor for constipation in non-dialysis patients. High serum triglyceride (TG) (OR=1.493, 95% CI 1.082-2.060, P=0.015) was a risk factor for constipation in CKD patients receiving hemodialysis. The risk factors for constipation in CKD patients included the use of phosphorus binding agents (OR=1.669, 95% CI 1.001-2.784, P=0.049) and use of iron agents (OR=1.745, 95% CI 1.047-2.909, P=0.033), high serum glucose (Glu)(OR=1.070, 95% CI 1.008-1.135, P=0.026) and TG (OR=1.254, 95% CI 1.017-1.546, P=0.034). Multivariate Logistic regression showed that female (OR=3.258, 95% CI 1.022-10.386, P=0.046) and diabetic nephropathy (OR=13.863, 95% CI 1.815-105.901, P=0.011) were independent risk factors for constipation in non-dialysis patients. In addition, diabetic nephropathy (OR=2.137, 95% CI 1.015-4.499, P=0.046) was a risk factor for constipation in CKD patients. Conclusion Diabetic nephropathy is an independent risk factor for constipation in CKD patients. The female gender represents an independent risk factor for constipation in non-dialysis patients.