Methylated inositol, D-pinitol (3-O-methyl-D-chiro-inositol), is a common constituent in legumes. It is synthesized from myo-inositol in two reactions: the first reaction, catalyzed by myo-inositol-O-methyltransferase (IMT), consists of a transfer of a methyl group from S-adenosylmethionine to myo-inositol with the formation of D-ononitol, while the second reaction, catalyzed by D-ononitol epimerase (OEP), involves epimerization of D-ononitol to D-pinitol. To identify the genes involved in D-pinitol biosynthesis in a model legume Medicago truncatula, we conducted a BLAST search on its genome using soybean IMT cDNA as a query and found putative IMT (MtIMT) gene. Subsequent co-expression analysis performed on publicly available microarray data revealed two potential OEP genes: MtOEPA, encoding an aldo-keto reductase and MtOEPB, encoding a short-chain dehydrogenase. cDNAs of all three genes were cloned and expressed as recombinant proteins in E. coli. In vitro assays confirmed that putative MtIMT enzyme catalyzes methylation of myo-inositol to D-ononitol and showed that MtOEPA enzyme has NAD + -dependent D-ononitol dehydrogenase activity, while MtOEPB enzyme has NADP + -dependent D-pinitol dehydrogenase activity. Both enzymes are required for epimerization of D-ononitol to D-pinitol, which occurs in the presence of NAD + and NADPH. Introduction of MtIMT, MtOEPA, and MtOEPB genes into tobacco plants resulted in production of D-ononitol and D-pinitol in transformants. As this two-step pathway of D-ononitol epimerization is coupled with a transfer of reducing equivalents from NADPH to NAD + , we speculate that one of the functions of this pathway might be regeneration of NADP + during drought stress.Keywords: carbohydrate metabolism, drought, legumes, Medicago truncatula, metabolic adaptation to stress, metabolic pathways. D-pinitol and drought resistance was also found by Guo and Oosterhuis (1997), who reported that soybean cultivars that showed increased resistance to soil drought accumulated larger quantities of D-pinitol than sensitive varieties.