Endophyte is one of the potential biocontrol agents for inhibiting plant pathogens. However, the mechanisms and characteristics involved in the inhibition of different phytopathogenic fungi by endophytes, especially walnut endophytes, are still largely unknown. The present study aimed to identify the walnut endophytic fungus LTL-G3 from a genetic point of view, assess the strain's antifungal activity, and determine the bioactivities of the substances it produces against plant pathogens. The homologous sequence of strain LTL-G3 was examined, and typical strains of the Trichoderma virens group were used to build NJ phylogenetic trees and analyze the taxonomic position of the strain. The biocontrol agent's antagonistic potential for many plant pathogenic fungi. By using silica gel G chromatography, the active components of the strain were separated and purified. The active components were identified using GC-MS and NMR. The strain LTL-G3 was identified as Trichoderma virens. Its fermentation and secondary metabolite extracts had a broad spectrum and strong inhibitory effect on the spread of six plant pathogens (Botrytis cinerea, Fusarium graminearum, Gloeosporium fructigenum, Phytophthora capsici, Rhizoctonia solani, and Valsa mali) evaluated, of which, its inhibition rate against Valsa mali reached 76.6% (fermentation extract) and 100% (ethyl acetate and n-butanol extracts). On silica gel G chromatography, bioactive compounds were divided into 6 fractions and 7 sub-fractions. Fr.2-2 was the sub-fraction that showed the greatest inhibitory against V. mali, as an inhibition percentage of 89.36% in 1 mg. mL-1. Fifteen key inhibitory chemicals identified using GC-MS. By examining the NMR data, the chemical make-up of the precipitated white solid was identified. The inhibition rate against V. mali increased by over 95% at a dosage of 1 mg. mL-1, indicating a significant linear association between compound A and that rate. The strain LTL-G3 can be applied as an efficient biological control agent against V. mali, and its highly inhibitive secondary metabolites provide the mechanism for this action.