Concerns have been expressed that persons with a pre‐existing mental disorder may represent a population at increased risk for COVID‐19 infection and with a higher likelihood of adverse outcomes of the infection, but there is no systematic research evidence in this respect. This study assessed the impact of a recent (within past year) diagnosis of a mental disorder – including attention‐deficit/hyperactivity disorder (ADHD), bipolar disorder, depression and schizophrenia – on the risk for COVID‐19 infection and related mortality and hospitalization rates. We analyzed a nation‐wide database of electronic health records of 61 million adult patients from 360 hospitals and 317,000 providers, across 50 states in the US, up to July 29, 2020. Patients with a recent diagnosis of a mental disorder had a significantly increased risk for COVID‐19 infection, an effect strongest for depression (adjusted odds ratio, AOR=7.64, 95% CI: 7.45‐7.83, p<0.001) and schizophrenia (AOR=7.34, 95% CI: 6.65‐8.10, p<0.001). Among patients with a recent diagnosis of a mental disorder, African Americans had higher odds of COVID‐19 infection than Caucasians, with the strongest ethnic disparity for depression (AOR=3.78, 95% CI: 3.58‐3.98, p<0.001). Women with mental disorders had higher odds of COVID‐19 infection than males, with the strongest gender disparity for ADHD (AOR=2.03, 95% CI: 1.73‐2.39, p<0.001). Patients with both a recent diagnosis of a mental disorder and COVID‐19 infection had a death rate of 8.5% (vs. 4.7% among COVID‐19 patients with no mental disorder, p<0.001) and a hospitalization rate of 27.4% (vs. 18.6% among COVID‐19 patients with no mental disorder, p<0.001). These findings identify individuals with a recent diagnosis of a mental disorder as being at increased risk for COVID‐19 infection, which is further exacerbated among African Americans and women, and as having a higher frequency of some adverse outcomes of the infection. This evidence highlights the need to identify and address modifiable vulnerability factors for COVID‐19 infection and to prevent delays in health care provision in this population.