Based on the annual reports of China's A-share listed companies from 2007 to 2020, this paper constructs a human capital risk index of China's listed companies through the methods of machine learning and explores the impact of state ownership on corporate human capital risk. The results show that compared with non-state-owned enterprises (non-SOEs), state-owned enterprises (SOEs) have lower human capital risk in China. Mechanism tests suggest that SOEs can offer higher compensation and benefits and maintain more stable employment relationships, which reduce human capital risk significantly. Additionally, this effect is more pronounced during periods of high economic policy uncertainty, in regions with weaker talent policies, and in areas with a lower proportion of aging labor force. The study also reveals that SOEs have lower human capital attraction and human capital retention risk than non-SOEs. Furthermore, SOEs have more educated and skilled employees, which contributes to higher human capital. Last, this study finds state ownership enhances innovation output, total factor productivity, and economic value added by mitigating human capital risk.