The "Three Rural Issues", encompass challenges related to agriculture, farmer, and rural area, which hold significant importance in driving comprehensive rural revitalization efforts in China. Farmer entrepreneurship, as a crucial means to enhance productivity, create job opportunities, and increase residents’ income, has gradually become a key driving force in promoting rural revitalization in the new stage of development in China. With the rapid development of rural e-commerce, farmer entrepreneurship has encountered new opportunities. This study utilizes the 2020 China Family Panel Studies (CFPS) data and employs a structural equation model (SEM) to analyze the direct impact of rural e-commerce participation on farmer entrepreneurial behavior, considering factors such as human capital, social capital, and network infrastructure. This study further explores the indirect effects and mechanisms of e-commerce participation as a mediating variable and analyzes the impact and mechanisms on agricultural entrepreneurship behavior. The findings are as follows: (1) E-commerce participation significantly promotes farmer entrepreneurial behavior; (2) E-commerce participation as a mediating variable has a positive indirect effect on the relationship between social trust, network infrastructure, human capital, and farmer entrepreneurial behavior; (3) E-commerce participation has a significant positive influence on farmer entrepreneurship in the agricultural sector, and farmers with higher levels of network infrastructure and human capital have a higher probability of choosing agricultural entrepreneurship under the influence of e-commerce participation. Finally, this study provides policy recommendations in terms of infrastructure construction, entrepreneurial policy environment, and education level, aiming to optimize the situation of farmer entrepreneurship and contribute to the comprehensive promotion of rural revitalization.Overall, the research in this paper effectively combines theory and empirical evidence to outline the direct and indirect impact mechanisms of rural e-commerce participation on farmers’ entrepreneurial behavior and agriculture-related entrepreneurial behavior and to test the effects of their impacts. First, most of the existing literature deals with farmers in individual sample areas, while the sample selected in this paper is farmers in the whole country, which is relatively more generalizable; second, most of the previous studies explore the level of e-commerce in the inter-provincial or county areas, while this paper expands the empirical study of rural e-commerce on the entrepreneurial behavior of farmers and the micro-period of agricultural entrepreneurial behavior, and focuses on the impacts of the e-commerce activities of farmers on their entrepreneurial behavior.