It has been reported that the risk of mental health problems such as anxiety or depression increases in patients with nontuberculous mycobacterial (NTM) infection. However, no studies have investigated whether the incidence of NTM infection increases in patients with depression. This study aimed to investigate the incidence of NTM infection in patients with depression and evaluate the association between NTM infection and depression stratified by age and sex. Data from 2002 to 2013 were collected from patients aged ≥ 20 years in the National Health Insurance Service-National Sample Cohort database. Patients with and without depression aged over 20 years were matched with 1 to 4 by sex, age, and year of diagnosis. The incidence rate was calculated in 100,000 person-years, and a multivariable subdistribution hazard model was used to evaluate the adjusted hazard ratio (aHR) for the development of NTM infection. We included 37,554 individuals (12,752 men and 24,802 women) and 149,213 controls in the depression and non-depression groups, respectively. The cumulative incidence of NTM infection did not differ significantly between the depression and non-depression groups during the follow-up period (22.2 vs. 24.5 per 100,000 person-years, p = 0.571). The age- and sex-stratified effects on the incidence of NTM infection were not significantly higher in patients with depression than in those without depression. After adjusting for covariates including age, sex, comorbidity, income, and region, the risk of NTM infection did not significantly differ between the depression and non-depression groups (aHR 0.83, 95% confidence interval 0.58-1.17). The incidence of NTM infections in patients with depression was not significantly higher than that in patients without depression. However, due to the small number of NTM infections, we might have underestimated the differences between the two groups. Further studies are needed to identify factors associated with NTM pulmonary disease in patients with depression.