Evidence of the relationship between fecal short-chain fatty acids (SCFA) levels, dietary quality and type 2 diabetes mellitus (T2DM) in rural populations is limited. Here, we aimed to investigate the association between fecal SCFA levels and T2DM and the combined effects of dietar quality on T2DM in rural China. In total, 100 adults were included in the case–control study. Dietary quality was assessed by the Alternate Healthy Eating Index 2010 (AHEI-2010), and SCFA levels were analysed using the GC-MS system. Generalised linear regression was conducted to calculate the OR and 95 % CI to evaluate the effect of SCFA level and dietary quality on the risk of T2DM. Finally, an interaction was used to study the combined effect of SCFA levels and AHEI-2010 scores on T2DM. T2DM participants had lower levels of acetic and butyric acid. Generalised linear regression analysis revealed that the OR (95 % CI) of the highest acetic and butyric acid levels were 0·099 (0·022, 0·441) and 0·210 (0·057, 0·774), respectively, compared with the subjects with the lowest tertile of level. We also observed a significantly lower risk of T2DM with acetic acid levels > 1330·106 μg/g or butyric acid levels > 585·031 μg/g. Moreover, the risks of higher acetic and butyric acid levels of T2DM were 0·007 (95 % CI: 0·001, 0·148), 0·005 (95 % CI: 0·001, 0·120) compared with participants with lower AHEI-2010 scores (all P < 0·05). Acetate and butyrate levels may be important modifiable beneficial factors affecting T2DM in rural China. Improving dietary quality for body metabolism balance should be encouraged to promote good health.