When public health emergencies occur, a large amount of low-credibility information is widely disseminated by social bots, and public sentiment is easily manipulated by social bots, which may pose a potential threat to the public opinion ecology of social media. Therefore, exploring how social bots affect the mechanism of information diffusion in social networks is a key strategy for network governance. This study combines machine learning methods and causal regression methods to explore how social bots influence information diffusion in social networks with theoretical support. Specifically, combining stakeholder perspective and emotional contagion theory, we proposed several questions and hypotheses to investigate the influence of social bots. Then, the study obtained 144,314 pieces of public opinion data related to COVID-19 in J city from March 1, 2022, to April 18, 2022, on Weibo, and selected 185,782 pieces of data related to the outbreak of COVID-19 in X city from December 9, 2021, to January 10, 2022, as supplement and verification. A comparative analysis of different data sets revealed the following findings. Firstly, through the STM topic model, it is found that some topics posted by social bots are significantly different from those posted by humans, and social bots play an important role in certain topics. Secondly, based on regression analysis, the study found that social bots tend to transmit information with negative sentiments more than positive sentiments. Thirdly, the study verifies the specific distribution of social bots in sentimental transmission through network analysis and finds that social bots are weaker than human users in the ability to spread negative sentiments. Finally, the Granger causality test is used to confirm that the sentiments of humans and bots can predict each other in time series. The results provide practical suggestions for emergency management under sudden public opinion and provide a useful reference for the identification and analysis of social bots, which is conducive to the maintenance of network security and the stability of social order.