Diabetic cardiomyopathy (DCM) is the leading cause of death in diabetic patients. Folic acid has a protective effect on diabetes-induced cardiomyocyte damage. The aim of this study was to explore the effects of folic acid on cardiomyocytes cultured under high glucose and fat (HGF) conditions and type 2 diabetes mellitus (T2DM) mice, and elucidate the underlying mechanisms. Bioinformatics analysis was used to identify the potential drugs through the Drug-Gene Interaction database. H9C2 cardiomyocytes were cultured with 30 mM glucose and 500 nM palmitic acid in the presence or absence of folic acid or YAP1 inhibitor (verteporfin) or YAP1 siRNA. The cell viability and lactate dehydrogenase (LDH) release were measured using specific assay kits. Pyroptosis was detected by flow cytometry. The concentrations of IL-1β and IL-18 in the supernatants were measured by ELISA. The NLRP3, ASC and caspase-1 mRNA levels were detected by qRT-PCR and that the proteins expression of NLRP3, ASC, cleaved caspase-1 (p10), caspase-1, YAP1, p-YAP1, LATS1 and P-LATS1 were detected by Western blotting. C57BL/6 mice were fed with high fat diet (HFD) combined with streptozotocin (STZ) intraperitoneally to establish a T2DM model, folic acid or PBS treatment for 8 weeks by oral gavage, blood glucose and body weight were measured every 4 weeks, mouse heart tissue was used to detect pyroptosis and hippo signaling pathway related protein expression. We identified 427 differentially expressed genes in the cardiac tissues of high fat diet + streptozotocin mice, among the 30 most significantly DEGs, folic acid was predicted to be the most likely therapeutic drug. Folic acid alleviated HGF-induced cell damage in vitro and in vivo by decreasing activation of the Hippo pathway, as indicated by lower LDH release and increased cell viability, and decreased expression of NLRP3, ASC, cleaved caspase-1, IL-1β, IL-18, p-YAP and p-LATS. Verteporfin or YAP1 siRNA neutralized the protective effect of folic acid by reversing YAP1-induced pyroptosis. Folic acid reduced NLRP3 inflammasome-mediated pyroptosis by down-regulating the Hippo signaling pathway, thereby effectively reducing T2DM-induced damage in H9C2 cells and animals.