Against the backdrop of escalating environmental pollution and resource depletion induced by traditional agricultural industry development, the imperative for agricultural efficiency and ecologically friendly practices has become pivotal for global agricultural sustainability. In the digital era, rural digitalization has substantially amplified agricultural production efficiency while notably reducing environmental pollution. This study is based on panel data from 1602 counties in China spanning from 2011 to 2020, measuring the levels of rural digitalization and agricultural green total factor productivity (AGTFP) across these counties, empirically examining their dynamic correlation. The research findings reveal: (1) A significant enhancement of AGTFP with the elevation of rural digitalization; for every 1 % increase in rural digitalization, AGTFP increases by 1.78 %. Robustness checks, including instrumental variables and quasi-natural experiments, affirm the validity of these conclusions. Furthermore, by comparing regional differences in China, it can be observed that the impact of rural digitalization on AGTFP varies across different areas: in the eastern, central, and western regions, for every 1 % increase in rural digitalization, the AGTFP increases by 2.65 %, 1.53 %, and 0.82 %, respectively. (2) Rural digitalization fosters an increase in AGTFP by stimulating rural entrepreneurial activity, with the mediation effect of rural entrepreneurial activity accounting for 3.34 % of the total effect. (3) Utilizing a threshold model, observations indicate that when rural digitalization surpasses the first threshold of 0.3200, the AGTFP coefficient escalates from 0.0462 to 0.7519. However, when rural digitalization exceeds the second threshold of 0.7118, this coefficient declines to 0.2429, signifying a nonlinear trend in the marginal effect of rural digitalization on AGTFP—initial enhancement followed by attenuation. (4) In the spatial model analysis, the study confirms spatial spillover effects of rural digitalization on AGTFP, indicating variations in spatial effects among different matrices. However, the indirect effects of rural digitalization on AGTFP, mainly influenced by the neighboring counties' digitalization levels, contribute more significantly than the direct effects. Based on these conclusions, this paper proposes augmenting investments in rural digitalization, implementing diversified rural digitalization schemes, invigorating rural entrepreneurial activity, and harmonizing regional digital development as novel approaches to enhance AGTFP, thereby fostering rural economic development.