Triterpenoids have wide applications in the pharmaceutical and agricultural industries. The glycosylation of triterpenoids catalyzed by UDP-glycosyltransferases (UGTs) is a crucial method for producing valuable derivatives with enhanced functions. However, only a few UDP-glucosyltransferases have been reported to synthesize the rare triterpenoids with linear-chain trisaccharide at C3-OH. This study revealed that the UGT91H subfamily primarily contributed to the 2"-O-glycosylation of triterpenoids with high regioselectivity, then the substrate scope was further expanded by ancestral sequence reconstruction (ASR). With ancestral enzyme UGT91H_A1 as a model, the sequence-structure-function relationship was explored. A RTAS loop (R212/T213/A214/S215) was identified to affect the substrate specificity of UGT91H_A1. Transferring this RTAS loop to the corresponding position of UGT91H enzymes successfully expanded their substrate spectra. The functional role of RTAS loop was further elucidated by molecular dynamics simulation and quantum mechanical computation. UGT91H_A1 was applied to the low-cost synthesis of terpenoid rhamnosides with a linear trisaccharide in combining with a self-sufficient UDP-rhamnose regeneration system. Finally, we developed a phylogeny-based platform to efficiently mining new UGT91Hs from plant genomic data. This study provided robust biocatalysts for synthesizing various triterpenoid glycosides with a linear trisaccharide and demonstrated ASR as an efficient tool in engineering the function of UDP-glycosyltransferases.