Suppose that $(M,g)$ is a compact smooth Riemannian manifold with a smooth boundary and suppose that $f$ is a smooth function on $M$ with the property that $$ \int_I f(\gamma(t))\,dt=0,$$ for any inextendible unit speed geodesic $\gamma:I\to M$.
Does it follow that $$ \int_M f\,dV_g=0?$$