The study aimed to estimate the prevalence and associated factors of undiagnosed type 2 diabetes (T2D) among adults in Morocco. Cross-sectional data were analyzed from 4779 people (≥ 18 years, mean age 41.7 years) who participated in the Morocco STEPS nationally representative survey in 2017 and had completed fasting blood glucose measurement. The results indicate that the prevalence of undiagnosed T2D was 5.9% (44.7% of total T2D), diagnosed T2D 7.3% and total T2D 13.2%. In the adjusted multinomial logistic regression analysis, older age (≥ 50 years), receipt of health care advice, and obesity were positively associated with undiagnosed T2D. Older age (≥ 50 years), urban residence, receipt of health care advice, ever cholesterol screening, moderate sedentary behaviour, obesity, hypertension, and elevated total cholesterol were positively associated with diagnosed T2D. In adjusted logistic regression analysis, older age (≥ 50 years), receipt of health care advice and cholesterol screening were negatively associated with undiagnosed T2D versus diagnosed T2D. A significant proportion of adults in Morocco had undiagnosed T2D and several associated factors were identified that can help guide interventions.