The invention belongs to the technical field of optical adhesives, and particularly relates to a hot-melt optical adhesive with an ultraviolet blocking function and a preparation method thereof, and the hot-melt optical adhesive comprises the following components in parts by weight: 100 parts of a mixed copolymer; 1-5 parts of a coupling agent; 0.2-0.6 part of an antioxidant; 0.1-0.6 part of a light stabilizer; 5-10 parts of a water blocking agent; the mixed copolymer is obtained by reacting an ethylene-vinyl acetate copolymer, a cross-linking agent, an anti-ultraviolet agent, an initiator and a polymerization initiator in a weight part ratio of 100: (5-10): (0.5-1): (1-3): (0.5-1); the anti-ultraviolet agent is composed of 4-methacrylamido salicylic acid and thiazolyl-2 (1H)-pyridone-4-methallyl formate, and the thiazolyl-2 (1H)-pyridone-4-methallyl formate is obtained in the mode that citric acid and 2-aminoethanethiol are subjected to a reaction to obtain an intermediate product, and then the intermediate product is subjected to methallyl alcohol esterification to obtain the thiazolyl-2 (1H)-pyridone-4-methallyl formate. According to the optical adhesive, the optical adhesive has a shielding effect on ultraviolet rays with the wavelength of 320-400 nm in sunlight, so that the damage of most ultraviolet rays to the optical cement is reduced, and the service life of the optical cement is prolonged.