The invention discloses a compound corrosion inhibitor of carbon steel in a citric acid pickling medium and a preparation method thereof. The compound corrosion inhibitor is prepared by compounding 2-undecyl-N-carboxymethyl N-hydroxyethly imidazoline (UHCI) and potassium iodide (KI), wherein the concentration of the UHCI is 0.25-0.39% while the concentration of the KI is 0.01-0.15%. The effect is optimum when the concentration of single UHCI is 0.4%; and under the condition that the total concentration is kept at 0.4%, the corrosion inhibition effect of the compounded UHCI and KI based on the above ranges is superior to that of the single UHCI with the concentration of 0.4%, thus the fact that the UHCI and the KI have better synergic corrosion inhibition effect is proved. In the invention, after the UHCI with the concentration of 0.3% and the KI with the concentration of 0.1% are added in a citric acid solution with the concentration of 4%, the corrosion current of the carbon steel is greatly lowered, and the corrosion inhibition efficiency is 94.24%. The compound corrosion inhibitor in the invention has low cost and less environment hazard, is green and environment-friendly, and has obvious corrosion inhibition effect for the carbon steel.