The invention discloses a preparation method of a tetrahydroglyoxaline inhibitor applicable to a drilling fluid. The preparation method comprises the following steps of a, adding 150mL of substance A,150mL of substance B and 26.8g of substance C in a beaker; b, using 8 to 12mL of water for dissolving 7.6g of substance D, and dropwise adding 1 to 2 drops of sodium hydroxide solution; c, using thesodium hydroxide solution for adjusting a pH value of a reaction mixture to 8, filtering for removing separated white solid, distilling off the substance A, the substance B and water, and obtaining apale yellow viscous liquid; d, using chloroform for extracting to obtain a product 1; e, adding 13.6g of product 1 and 7.4g of substance E in to a three-necked flask, and obtaining an orange-yellow viscous transparent liquid; f, using ethyl acetate as an eluent, and obtaining a product 2; g, adding 60mL of substance B and 5.8g of substance F into the three-necked flask, and obtaining a pale yellowviscous liquid; h, extracting with acetone, removing a solvent, using benzene for recrystallizing, and obtaining a white product. The polyamide inhibitor prepared by adopting the method has the characteristics of high temperature resistance, remarkable inhibitory effect, less influence on rheological property, and the like, and is applicable to various water-based drilling fluid systems.