The invention relates to a preparation method of TiO2 photocatalyst by loading TiO2 to diatomite formed in advance and doping rare earth, and belongs to the technical field of photocatalysis. The preparation method comprises the steps of: pickling original diatomite, roasting the pickled diatomite, and uniformly mixing the roasted diatomite, a binder, a fluxing agent and the like so as to obtain molded diatomite; and using tetrabutyl orthotitanate and dehydrated alcohol as raw materials, preparing TiO2 and rare earth doped TiO2 sol by a sol-gel method, macerating the preformed diatomite in the sol, drying the macerated diatomite, and calcining the dried diatomite so as to obtain the load type photocatalyst. The photocatalyst can prevent the TiO2 from running off; besides, the rare earth is doped, so that the utilization rate of visible light by the TiO2 is increased; when a mercury-vapor lamp is used for 3 hours, 95% of a rhodamine b solution can be degraded; when the photocatalyst is illuminated for an hour under sunlight, escherichia coli can be thoroughly killed; when the photocatalyst is illuminated for 24 hours by common daylight lamps, 92% of methanal can be degraded; the photocatalyst is excellent in photocatalytic property and stability, which indicates that the photocatalyst has favorable application prospects in the respects of waste water treatment, sanitation and sterilization, air purification and the like.