Given the increasingly serious diseases [anthracnose mainly caused by Colletotrichum gloeosporioides (C. gloeosporioides)] of walnut plants in recent years and the environmental pollution caused by chemical pesticides, phosphites had been shown to be new environmental friendly chemical agents for plants. In this study, seven-year-old ‘Xiangling’ and ‘Xifu 4’ walnut trees were treated with different concentrations of potassium phosphite foliar fertilizer. The treatments were T1 (1500-fold dilution fluid of potassium phosphite), T2 (1000-fold dilution fluid of potassium phosphite) and CK (water). The results showed that the disease incidence rates of fruit treated with potassium phosphite were lower than CK. Moreover, the diseased fruit rates of ‘Xiangling’ (4) and ‘Xifu 4’ (14) in T2, lower than they (28 and 38) in CK. Metabolome and transcriptome further analysis revealed that potassium phosphite significantly increased the expression level of genes in the photosynthesis pathway and accumulated terpeniods, phenolic, salicylic acid and other secondary metabolic pathways. In addition, as salicylic acid content significantly increased, the expression level of the gene encoding the disease resistance-related protein (PR1) showed a corresponding trend. In vitro antibacterial tests of six related metabolites on C. gloeosporioides showed that hederagenin, 23-hydroxybetulinic acid, ursolic acid, eriodictyol, and salicylic acid had effect on C. gloeosporioides spores, among which salicylic acid and ursolic acid significantly inhibited the growth of C. gloeosporioides. Further experiments revealed that the minimum inhibitory concentrations of salicylic acid and ursolic acid were 2 and 5 g L−1, respectively. In addition, potassium phosphite could directly inhibit the growth of C. gloeosporioides spores in vitro tests. In conclusion, potassium phosphite enhanced walnut fruit disease resistance through up-regulated the genes related to photosynthetic performance and abundant in secondary metabolites, such as salicylic acid, terpenoids and phenolics, which were antibacterial effects on C. gloeosporioides.