Compound I was synthesized from N-propyl-1H-1,2,4-Triazole-3,5-diamine as the starting material with benzene formaldehyde; which was then reacted Me (E)-3-Methoxy-2-Me propenoate obtain compound II; finally, compound II was then deprotected to obtain target product 2-Amino-6-methyl-4-propyl-4,5-dihydro[1,2,4]triazolo[1,5-a]pyrimidin-5-one (compound III). The reaction was optimized by studying the catalyst, molar ratio, reaction temperature, and the recovery of benzaldehyde was further considered. The results showed that the best process conditions of compound I were ice acetic acid catalyst, reflux reaction, compound II's best catalyst was sodium methanol, 115°C reaction, and the target product was obtained under acidic conditions. Under the best process conditions, the yield of compound I is more than 96%, the yield of compound II is more than 90%, and the yield of compound III is more than 95%.