Background: Public health workers are essential to responding to the coronavirus disease 2019 (COVID-19) epidemic, but research on anxiety and stress among public health workers during the epidemic is limited. This study aimed to evaluate related factors affecting mental health among public health workers during the epidemic.Methods: Between February 19 and 25, 2020, an online, cross-sectional study was conducted among public health workers in a city in China. Mental health status was assessed using the Chinese versions of the Generalized Anxiety Disorder-7 (GAD-7) scale and Patient Health Questionnaire-9 (PHQ-9), both with a cutoff score of 5. Work-related variables, workloads and sacrifices, and personal perceptions were also assessed.Results: The prevalence of anxiety and depression were 49.2% and 45.7%, respectively, among public health workers. Three risk factors and one protective factor, namely, overcommitment (OR = 1.10∼1.20, p < 0.001), perceived troubles at work (OR = 1.14∼1.18, p < 0.001), perceived tension (OR = 1.11, p < 0.001) and the capability to persist for more than 1 month at the current work intensity (OR = 0.41∼0.42, p < 0.001) were found to be independently associated with anxiety and depression in the multivariable logistic regression analyses after propensity score matching. But the Bayesian networks analysis found that the last three factors directly affect anxiety and depression.Conclusion: Psychological responses to COVID-19 were dramatic among public health workers during the severe phase of the outbreak. To minimize the impact of the epidemic, working conditions should be improved, and easily accessible psychological support services should be implemented.