Screening and treatment of dysglycemia (prediabetes and diabetes) represent significant challenges in advancing the Healthy China initiative. Identifying the crucial factors contributing to dysglycemia in urban-rural areas is essential for the implementation of targeted, precise interventions. Data for 26,157 adults in Fujian Province, China, were collected using the Social Factors Special Survey Form through a multi-stage random sampling method, wherein 18 variables contributing to dysglycemia were analyzed with logistic regression and the random forest model. Investigating urban-rural differences and critical factors in dysglycemia prevalence in Fujian, China, with the simultaneous development of separate predictive models for urban and rural areas. The detection rate of dysglycemia among adults was 35.26%, with rates of 34.1% in urban areas and 35.8% in rural areas. Common factors influencing dysglycemia included education, age, BMI, hypertension, and dyslipidemia. For rural residents, higher income (OR = 0.80, 95% CI [0.74, 0.87]), average sleep quality (OR = 0.89, 95% CI [0.80, 0.99]), good sleep quality (OR = 0.89, 95% CI [0.80, 1.00]), and high physical activity (PA) (OR = 0.87, 95% CI [0.79, 0.96]) emerged as protective factors. Conversely, a daily sleep duration over 8 hours (OR = 1.46, 95% CI [1.03, 1.28]) and middle income (OR = 1.12, 95% CI [1.03, 1.22]) were specific risk factors. In urban areas, being male (OR = 1.14, 95% CI [1.02, 1.26]), cohabitation (OR = 1.18, 95% CI [1.02, 1.37]), and central obesity (OR = 1.35, 95% CI [1.19, 1.53]) were identified as unique risk factors. Using logistic regression outcomes, a random forest model was developed to predict dysglycemia, achieving accuracies of 75.35% (rural) and 76.95% (urban) with ROC areas of 0.77 (rural) and 0.75 (urban). This study identifies key factors affecting dysglycemia in urban and rural Fujian residents, including common factors such as education, age, BMI, hypertension, and dyslipidemia. Notably, rural-specific protective factors are higher income and good sleep quality, while urban-specific risk factors include being male and central obesity. These findings support the development of targeted prevention and intervention strategies for dysglycemia, tailored to the unique characteristics of urban and rural populations.