The invention discloses a hydroxyl film-forming plugging agent for drilling fluid and a preparation method thereof. Hydroxyl film-forming plugging agent for drilling fluid includes the following components: magnetic chitosan microspheres, polyacrylic acid hydrogel, N-isopropylacrylamide, N,N-methylenebisacrylamide, sodium persulfate, N, N, N', N'-tetramethylethylenediamine, carboxymethyl cellulose, nano calcium carbonate, dispersant, hydroxyl compound, polyacrylamide hydrogel; hydroxyl compound includes complex alcohol GPH‑II, Nano silica, polyhydroxy resin WN2‑1 and polyanionic cellulose. The hydroxyl film-forming plugging agent for drilling fluid of the present invention has the advantages of reducing fluid loss, stabilizing the well wall, avoiding pipe sticking due to pressure difference, strong ability to carry debris in suspension, good rheology and plugging effect, and capable of deforming and plugging nanopores of shale With micro-cracks, it is non-toxic, does not pollute the environment, does not pollute the formation, and has the advantages of good compatibility.