Abstract Background Studies have shown that plant endophytic microbial communities are ubiquitous and closely related to plant growth and health. To clarify the mechanism of the melon varieties with high resistant to wilt, the endophytic microbial compositions and metabolites in roots of melon varieties with high resistant ability to wilt were analyzed. Results The results showed that the abundances of Firmicutes, Ascomycota, Bacillus, Bradyrhizobium, Amycolatopsis, Actinospica, and Catenulispora all increased in roots of wilt high resistant melon varieties (MT) which compared to wilt susceptible melon varieties (MS). Meanwhile, Ochrobactrum, Bordetella, Roseateles, Staphylococcus, Acidovorax, Amycolatopsis, Catenulispora, Promicromonospora, and Gymnopilus were the unique endophytic microbes in roots of MT. Moreover, in comparison with the MS varieties, the functions of Defense mechanisms, Secondary metabolites biosynthesis, transport and catabolism, Nucleotide transport and metabolism, Signal transduction mechanisms, Coenzyme transport and metabolism, Carbohydrate transport and metabolism and Amino acid transport and metabolism all increased in roots of MT varieties. Additionally, the nucleotide metabolism and biosynthesis of cofactors metabolic pathways were also significantly increased in roots of MT varieties. On the other hand, the untargeted metabolome results showed that Biosynthesis of various plant secondary metabolites, Nucleotide metabolism and Biosynthesis of cofactors metabolic pathways were significantly increased in the expression of MT varieties; and the content of metabolic compounds such as flavonoids, Cinnamic acid compounds, Organic acid compounds, and Nucleotides were increased. In addition, the correlation between microbiome and metabolome indicates a significant correlation between the two. Conclusions All above results suggested that higher abundant antagonistic microbes and metabolic functions of endophytes in roots of wilt high resistant melon varieties (MT) were the important mechanisms for their high resistance to wilt. Graphical Abstract