This study examines the impact of the digital economy on sustainable green innovation in China, with a focus on the mediating roles of debt financing costs and resource allocation efficiency. Leveraging a comprehensive dataset of 24,741 firm-year observations from 2008 to 2022, we utilize fixed-effects regression models to analyze the relationships between the digital economy, debt financing costs, resource allocation efficiency, and sustainable green innovation. The results demonstrate that the digital economy positively influences sustainable green innovation, with this effect being partially mediated by reductions in debt financing costs and improvements in resource allocation efficiency. Specifically, the digital economy lowers financing costs and optimizes resource allocation, which collectively enhances green innovation sustainability. The findings remain consistent across various endogeneity and robustness checks, including instrumental variable approach, lagged effects, heckman two-stage method, sample adjustments, alternative measures, and model specifications. Additionally, heterogeneity tests reveal that the digital economy's positive effect is stronger for firms in the early and middle stages of their life cycle and for those operating in less-polluting industries. These insights contribute to the growing literature on digital technologies and sustainable development, offering valuable implications for managers and policymakers aiming to harness the digital economy for advancing sustainable green innovation.