Excessive ultraviolet (UV) radiation causes a series of adverse effects on human skin, such as erythema and tanning due to the produce of endogenous melanin of human skin. Inspired by the self‐defense mechanism of human skin to prevent UV radiation damage, we construct a natural and biocompatible Carb@PDA‐L sunscreen hydrogel by doping melanin‐like L‐lysine doped polydopamine (PDA‐L) to biocompatible poly‐γ‐glutamic acid based hydrogel matrix Carb, which displays good biosafety, efficient UV shielding performance and excellent antioxidative and anti‐inflammatory performance in the application of the skin protection of sun and repair after sunburn. The melanin‐like PDA‐L can be synthesized by the oxidative polymerization of dopamine triggered by L‐lysine under alkali‐free condition, which exhibits increase absorption intensity in the UV region and better reactive oxygen species removal performance compared with undoped polydopamine in the perspective of a UV absorber. Meanwhile, PDA‐L, as the synthetic analogue of natural melanin, has good biosafety, which can avoid the skin oxidative damage and penetrative toxicity of the conventional sunscreen.