The invention belongs to the field of medicine and chemical industry, and specifically discloses a preparation of 5-(2-cyano4-pyridyl)-3-(4-pyridyl)-1,2,4-triazole (topinostat) The process is characterized in that the compound III 2-cyano group is synthesized by a one-pot method using compound II methyl isonicotinate as a starting material and phosphorus oxychloride, N,N-dimethylformamide, iodine simple substance, and 28% ammonia water Methyl isonicotinate, then compound IV 2-cyanoisonicotinic acid hydrazide is synthesized, and then compound IV2-cyanoisonicotinic acid hydrazide is condensed with 4-cyanopyridine to prepare topinostat crude product Ia, and crude product Ia is passed through with p-toluene After the sulfonic acid is salified, topinastat p-toluenesulfonate Ib is formed, and finally desalted and refined to obtain the finished product I of topinostat. The invention reduces the reaction steps, improves the yield of finished products, has low toxicity in the reaction process, has little impact on the environment, has a short reaction route, and greatly reduces the cost.