Plant-specialized metabolites play pivotal roles in adapting to dynamic environments and promoting human health. Among these metabolites, glyceollins and soyasaponins hold particular importance in responding to environmental stresses and contributing to sustainable human nutrition, including the development of novel pharmaceuticals. Glyceollins are phytoalexins induced in legume species, derived from the isoflavonoid branch of the phenylpropanoid pathway, while soyasaponins belong to the triterpenoid class and are naturally abundant in legume species without requiring induction. Despite their significance, the genetic basis underlying glyceollin induction and soyasaponin biosynthesis remains poorly understood. Furthermore, previous studies on their genetic basis have primarily focused on model or major crop species, with limited research on wild crop species, such as wild soybean. To address these knowledge gaps, our study utilized wild soybeans, known for their abundant and unexplored genetic diversity compared to cultivated soybeans, to unravel the genetic basis of glyceollin induction and soyasaponin production. We employed a metabolite-based genome-wide association (mGWA) approach and identified eight SNPs on chromosomes 3, 9, 13, 15, and 20 significantly associated with glyceollin induction. Six genes near a significant SNP (ss715603454) on chromosome 9 formed two clusters, encoding enzymes of the glycosyltransferase class. Furthermore, we discovered transcription factor genes, such as MYB and WRKY, within the linkage disequilibrium of the significant SNPs on chromosome 9. Epistasis and strong selection signals were also detected for the four significant SNPs on chromosome 9, indicating their role as major evolutionary factors influencing glyceollin variation in natural populations. Moreover, to investigate the genetic basis of phytochemical diversity, we conducted comprehensive phenotyping using LC-MS analysis on an association panel of 190 wild soybean ecotypes from diverse natural environments. Among the 874 metabolite peaks detected, we successfully annotated 485 metabolites. We identified 1155 SNPs significantly associated with 359 metabolites by performing a genome-wide association study. Clustering analysis revealed eight QTLs, named QTL-multiple metabolite clusters, showing significant associations with identified metabolites. By mining data within the linkage disequilibrium blocks encompassing these QTLs, we identified 612 annotated genes. From this set, we selected 16 candidate genes based on their relevance to the triterpenoid and phenylpropanoid-derived isoflavonoid biosynthetic pathways. Among these 16 candidate genes, UDP-dependent glycosyltransferase (UGT) was considered a promising candidate gene. Sequence analysis of this UGT gene in 46 wild soybean ecotypes unveiled two haplotypes with three SNPs on exon-1, leading to amino acid changes. The following association analysis showed these two haplotypes were significantly associated with high and low soyasaponin production. These two haplotypes also exhibited notable differences in expression levels. Our findings contribute valuable insights into the genetic mechanisms underlying phytochemical diversity, specifically the induction of glyceollins and the production of soyasaponins. This knowledge is instrumental in developing climate-resilient, high-value crops with enhanced medicinal properties, ultimately benefiting both plant and human health.