Let
$$c := \int_0^1 f(x) \, dx \tag{1}$$
Without loss of generality, we may assume
$$\int_0^1 (f(x)+c)^2 \, dx >0$$
otherwise $f=-c$, hence $f=0$ (since $f(1)=0$, by assumption) and in this case the inequality is trivially satisfied.
Integration by parts yields
$$\begin{align*} \int_0^1 (f(x)+c)^2 \, dx &= \bigg[x \cdot (f(x)+c)^2\bigg]_0^1 - 2 \int_0^1 x \cdot (f(x)+c) \cdot f'(x) \\ &= c^2 + 2 \int_0^1 -(f(x)+c) \cdot f'(x) \cdot x \end{align*}$$
where we used that $f(1)=0$. By applying Jensen's inequality, we obtain
$$\int_0^1 |f(x)+c|^2 \, dx -c^2 \leq 2 \sqrt{ \int_0^1 |f(x)+c|^2 \, dx} \cdot \sqrt{\int_0^1 x^2 \cdot f'(x)^2 \, dx}$$
i.e.
$$\sqrt{\int_0^1 |f(x)+c|^2 \, dx} - \frac{c^2}{\sqrt{\int_0^1 |f(x)+c|^2 \, dx}} \leq 2 \sqrt{\int_0^1 x^2 \cdot f'(x)^2 \, dx} $$
Squaring both sides yields
$$\int_0^1 |f(x)+c|^2 \, dx - 2c^2 + \frac{c^4}{\int_0^1 |f(x)+c|^2 \, dx} \leq 4 \int_0^1 x^2 \cdot f'(x)^2 \, dx \tag{2}$$
Note that by definition
$$\int_0^1 |f(x)+c|^2 \, dx = \int_0^1 f(x)^2 \, dx +2c \underbrace{\int_0^1 f(x) \, dx}_{c} + c^2 \stackrel{(1)}{=} \int_0^1 f(x)^2 \, dx + 3 \left( \int_0^1 f(x) \, dx \right)^2 $$
Thus, $(2)$ is equivalent to
$$\int_0^1 |f(x)|^2 \, dx + \left( \int_0^1 f(x) \, dx \right)^2 + \underbrace{\frac{c^4}{\int_0^1 |f(x)+c|^2 \, dx}}_{\geq 0} \leq 4 \int_0^1 x^2 \cdot f'(x)^2 \, dx$$