Since the inception of Public Service Motivation (PSM) by Perry and Wise, substantial research has been conducted in this domain. However, there is a dearth of scholarly investigation into the impact of changing public service environments, specifically the perception of workplace risk, on public service motivation. Recent public health crises, such as the COVID-19 pandemic, have necessitated significant changes in frontline public employees’ work environments. As they frequently engage in epidemic prevention and control activities, which entail direct exposure to the virus, their motivation may fluctuate based on their perceived risks. Female employees, in particular, facing the dual pressures of work and family responsibilities, are more prone to being affected. Drawing upon the human behavioral motivation and Stress-Strain-Outcome framework, this study examines the influence mechanism of risk perception on public service motivation among 214 female employees who participated in epidemic control during the 2022 lockdown period in Shanghai. As the findings indicate, risk perception detrimentally affects their public service motivation both directly and indirectly through emotional exhaustion or anxiety-emotional exhaustion dual mediation, whereas anxiety does not mediate such a relationship. The study’s theoretical significance lies in its potential to broaden the scope of antecedent research on public service motivation and address the research gap about the mechanisms through which risk perception influences public service motivation during public health emergencies. Practically, these insights may assist public organizations in mitigating the adverse effects of risk perception, thereby enhancing their employees’ well-being and service effectiveness.