Objective: To investigate the prevalence of latent tuberculosis infection (LTBI) in the middle-aged and elderly type 2 diabetes mellitus (T2DM) patients in rural areas of China, and to explore the influence of mindfulness on depression and the mediation effect of anxiety in T2DM comorbidity with LTBI patients. Methods: From November 2 to November 12, 2021, using a convenient sampling method, 469 middle-aged and elderly patients T2DM in rural areas of Zhongmu County, Henan Province were selected as the research participants for questionnaire survey and LTBI detection. The questionnaire includes general information, Five-item Mindful Awareness Attention Scale, Generalized Anxiety Disorder Questionnaire, and Patient Health Questionnaire. LTBI was detected by interferon-gamma release assay (IGRA). Structural equation modeling was used to test the mediation effect of anxiety between mindfulness and depression. Results: Of the 469 participants, 74 were IGRA positive, accounting for 15.78%. The score of Five-item Mindful Awareness Attention Scale in the 74 T2DM participants with LTBI was 5.00 (5.00, 10.00). The score of Patient Health Questionnaire and Generalized Anxiety Disorder Questionnaire in female were higher than male (0.00 (0.00, 2.00) vs. 0.00 (0.00, 0.00) and 0.50 (0.00, 3.00) vs. 0.00 (0.00, 0.75), respectively); the score of Patient Health Questionnaire in those with an annual income of less than RMB 20000 yuan was higher than those with an annual income of more than RMB 20000 yuan (0.00 (0.00, 2.25) vs. 0.00 (0.00, 0.00)); the score of Generalized Anxiety Disorder Questionnaire in those did not drink in the past 12 months was higher than those drank in the past 12 months (0.00 (0.00, 3.00) vs. 0.00 (0.00, 0.00)); the score of Patient Health Questionnaire in those without hypertension was higher than those with hypertension (1.00 (0.00, 4.00) vs. 0.00 (0.00, 0.75), all the differences were statistically significant (Z values were 1.789, 2.509, 2.572, 2.133, and 2.018, respectively, all P<0.10). The prevalence of anxiety and depression in T2DM patients with LTBI were 8.10% (6/74) and 5.40% (4/74), respectively, and 3 (4.10%, 3/74) had both depression and anxiety simultaneously. We used mindfulness as independent variable, depression as dependent variable, anxiety as mediator, and gender, annual income, whether drink in the past 12 months, and whether had hypertension as covariates, to build structural equation model. The model had good reliability, convergence validity and discrimination validity. In the model, the effects of mindfulness on anxiety (β=-0.394 (95%CI:-0.778-0.115), P=0.036), and anxiety on depression (β=0.878 (95%CI:0.446-0.979), P<0.001) were both statistically significant. The mediating effect of mindfulness on depression was statistically significant (β=-0.346 (95%CI:-0.628-0.103), P=0.011). Conclusion: The conditions of anxiety and depression in middle-aged and elderly T2DM patients comorbidity with LTBI of rural areas in China should be paid attention, preventive intervention and psychological mindfulness is suggested to be carried out.