The invention discloses an ultraviolet-resistant fabric and a preparation method thereof. The fabric comprises a fabric surface layer and an ultraviolet-resistant layer deposited on the fabric surface layer, wherein the ultraviolet-resistant layer is a blending layer of polyurethane, sodium alginate, hydroxyethyl methyl cellulose, hindered amine light stabilizers, hydroxyphenyl benzotriazole ultraviolet absorbents, nano ultraviolet absorbents and rare earth fluorescent compounds. The fabric is excellent in ultraviolet-resistant effect, excellent in moisture absorption property, simple in production process, has resistance to sunlight and perspiration and does not need to be washed with water; a lot of water and energy can be saved; the fabric coated with the ultraviolet-resistant coating is soft, tough, washable and durable, and is excellent in properties.