By restricting $f$ to a fixed compact $K$ we may assume that $f$ is integrable. Applying dominated convergence on both sides we get that the inequality holds for all integrable bounded $g$.
By Lebesgue's Differentiation, $$ f(t)=\lim_{r\to0}\frac1{|B_r(t)|}\int_{B_r(t)}f(x)\,dx $$ Almostalmost everywhere on $K$. For all such $t$, $$ |f(t)|=\lim_{r\to0}\frac1{|B_r(t)|}\bigg|\int_{\mathbb R^d}f(x)\,1_{B_r(t)}\,dx\bigg|\leq\lim_{r\to0}|B_r(t)|^{\frac1p-1} =c\,\lim_{r\to0}r^{d (1-p)/p}=0 $$ since the exponent is positive. So $f=0$ a.e. on $K$, and as this can be done for all $K=\overline{B_n(0)}$, $f=0$ a.e.