After adjustment for covariates, the habitual use of vitamin D supplements was significantly associated with a 34% lower risk of COVID-19 infection (OR, 0.66; 95% CI, 0.45–0.97; P = 0.034). Circulating vitamin D levels at baseline or genetically predicted vitamin D levels were not associated with the risk of COVID-19 infection. The association between the use of vitamin D supplements and the risk of COVID-19 infection did not vary according to the different levels of circulating or genetically predicted vitamin D (P-interactions = 0.75 and 0.74, respectively).