Totally geodesic submanifolds and conformal class of metrics
The answer is no. Take $M$ to be the unit disk in $\Bbb R^2$ and consider the two metrics $g_1 = g_{\text{eucl}}$ the Euclidean metric and $g_2 = g_{\text{hyp}} = \frac{4}{(1-|x|^2)^2}g_1$ the hyperbolic metric.
Any straight line in $M$ is a geodesic in $(M,g_1)$, therefore a totally geodesic submanifold. But only those passing through the origin are geodesics in $(M,g_2)$.
You can adapt this example in any dimension: any affine hyperplane intersected with the unit ball is a totally geodesic euclidean submanifold while only those passing through the origin will be totally geodesic hyperbolic submanifolds.
There is already a good counter-example in Didier's answer. Here is a slightly different one: You can find horospheres in the upper half space model of hyperbolic space which are totally geodesic in the Euclidean metric but not in the hyperbolic metric.
To see what goes wrong in your computation, note that most of the terms in your expression for $\bar{\nabla}^2_{\tilde{X}} \tilde{Y}$ are tangent to $M$ and therefore don't appear in the second fundamental form, except possibly the term proportional to $\mathrm{grad} f$. For a sanity check, you can verify that this term is nonzero in these examples.