Objectives: To investigate COVID-19 risk by occupational group. Design: Prospective study of linked population-based and administrative data. Setting: UK Biobank data linked to SARS-CoV-2 test results from Public Health England from 16 March to 3 May 2020. Participants: 120,621 UK Biobank participants who were employed or self-employed at baseline (2006-2010) and were 65 years or younger in March 2020. Overall, 29% (n=37,890) were employed in essential occupational groups, which included healthcare workers, social and education workers, and other essential workers comprising of police and protective service, food, and transport workers. Poisson regression models, adjusted for baseline sociodemographic, work-related, health, and lifestyle-related risk factors were used to assess risk ratios (RRs) of testing positive in hospital by occupational group as reported at baseline relative to non-essential workers. Main outcome measures: Positive SARS-CoV-2 test within a hospital setting (i.e. as an inpatient or in an Emergency Department). Results: 817 participants were tested for SARS-CoV-2 and of these, 206 (0.2%) individuals had a positive test in a hospital setting. Relative to non-essential workers, healthcare workers (RR 7.59, 95% CI: 5.43 to 10.62) and social and education workers (RR 2.17, 95% CI: 1.37 to 3.46) had a higher risk of testing positive for SARS-CoV-2 in hospital. Using more detailed groupings, medical support staff (RR 8.57, 95% CI: 4.35 to 16.87) and social care workers (RR 2.99, 95% CI: 1.71 to 5.24) had highest risk within the healthcare worker and social and education worker categories, respectively. In general, adjustment for covariates did not substantially change the pattern of occupational differences in risk. Conclusions: Essential workers in health and social care have a higher risk of severe SARS-CoV-2 infection. These findings underscore the need for national and organisational policies and practices that protect and support workers with elevated risk of SARS-CoV-2 infection.