Endophyte Bacillus methylotrophicus NJ13 was isolated from Panax ginseng. Its sterile fermentation liquid showed a significant inhibitory effect against Ilyonectria robusta, causing the rusty root rot of P. ginseng and P. quinquefolius. The antifungal protein was obtained after precipitation by 20% saturated ammonium sulfate, desalted by Sephadex G-25, weak anion exchange chromatography, and gel filtration chromatography. SDS-PAGE showed that the purified protein was approximately 29 KDa. The antifungal protein after desalting was not resistant to temperatures higher than 100 °C, resistant to acid conditions, and did not tolerate organic solvents and protease K. The amino acid sequence of purified antifungal protein had an identity of 76% to flagellin from Bacillus velezensis. The isoelectric point of the protein was 4.97 and its molecular mass was 27 KDa. Therefore, a specific primer G1 was designed based on the flagellin gene sequence, and a 770 bp gene sequence was cloned in NJ13 genomic DNA, which shared the same size of flagellin. There were ten base differences between the gene sequences of flagellin and the cloned gene, however, the amino acid sequence encoded by the cloned gene was identical to the flagellin. In conclusion, the antifungal protein produced by biocontrol agent NJ13 contained a flagellin protein.