The invention discloses a preparation method of a 
corrosion inhibitor for inhibiting 
corrosion of supercritical CO2 to low-carbon 
microalloyed steel, belonging to the field of 
corrosion resistance. The preparation method comprises the steps of firstly, adding higher 
fatty acid into a three-neck flask provided with a condensation and 
reflux device, a water separator and an S-shaped condensation 
pipe, vacuumizing, replacing N2 2-4 times, adding a proper amount of 
polyethylene polyamine and a water-carrying agent under the protection of N2 gas, and heating until the reaction enters an 
acylation stage; then, continuing to heat to a cyclodehydration temperature after the 
acylation reaction is ended, and heating until the reaction is ended; carrying out reduced pressure 
distillation to remove redundant water-carrying agent and water in the product, and recrystallizing to obtain the 
corrosion inhibitor imidazoline. An imidazoline derivative is prepared through the steps of reacting for 3h while continuously stirring imidazoline and 
benzyl chloride at the temperature of 50-90 DEG C according to the 
molar ratio of 1:1.1; after the reaction is ended, adding 
thiourea with the same 
molar weight as imidazoline, heating to 90-110 DEG C, continuously stirring and reacting for 1.5-2h. The 
corrosion inhibitor is low in dosage, free of 
pollution, simple in production, incapable of injuring human bodies and capable of effectively controlling the corrosion of supercritical CO2 to low-carbon 
microalloyed steel.