The improvement of enterprise ESG performance is one of the key driving forces to achieve the goal of economic and social green development. There is a gap between knowledge and practice in the ESG performance of Chinese enterprises, and digital transformation (DT) provides new ideas for ESG development. The research purpose of this paper is to explore the impact mechanism of DT on ESG and the specific path of DT to drive ESG. It provides a reference for listed enterprises to rely on DT to empower their sustainable development capability. This paper takes the panel data of A-share listed enterprises from 2011 to 2021 as the sample and measures the core indicators using the text mining method, modified Jones model, and Roy-Chowdhury model. On this basis, using a combination of econometric models and qualitative comparative analysis, we empirically analyze the impact mechanisms of DT on ESG as well as the specific grouping paths that drive ESG performance. The main conclusions are shown as follows. First, DT can significantly reduce ESG, with an impact coefficient of − 0.013, which is significant at the 5% level. It reflects that the DT of enterprises at this stage has certain deficiencies. There is a matching lag in the enterprise's internal organizational resources. The entry of digital technology will have a certain impact on traditional operations, and the high uncertainty of DT adds some hidden costs to the enterprise. Secondly, there is an indirect suppression effect of accrued earnings management (AEM) in the transmission mechanism of DT affecting ESG. It is verified that DT can reduce information asymmetry and inhibit EM activities, thus reducing the impact on ESG. Finally, a total of six configurations achieved high ESG valuations. High technology practice-low performance manipulation; digital intelligence-low performance manipulation; digital intelligence-digital resources; digital resources-inadequate digital infrastructure.; high technology practice-bottom technology deficiency; digital intelligence-high performance manipulation. Through configuration analysis, the suppression effect of EM is further verified. The lack of AEM is usually the core condition of the high-valuation group. Meanwhile, digital intelligence, digital resources, and digital technology practice can drive the improvement of enterprise ESG. The instrumental variables approach and robustness tests support these findings.