The Hausdorff dimension of the zero set of a real analytic function

Yes, this is true and follows, e.g. from Łojasiewicz's stratification theorem: Every real-analytic subset of $R^n$ is a locally finite (hence, countable) union of pairwise disjoint smooth real-analytic submanifolds. Take a look for instance here for references and generalizations:

A. Parusinsky, Lipschitz stratification of subanalytic sets Annales scientifiques de l’É.N.S. 4e série, tome 27, no 6 (1994), p. 661-696


I would like to propose an elementary approach based on the implicit function theorem.

Consider $F_0=f^{-1}(0)$. By the implicit function theorem if $\nabla f(x)\neq 0$ for some $x\in F_0$ then $F_0$ is a graph locally around $x$ and thus of dimension $n-1$ (actually a smooth submanifold).

Consider then the exceptional set $F_1=\{x:f(x)=0\wedge \nabla f(x)=0\}$. If $\nabla^2 f(x)\neq 0$ for some $x\in F_1$ then in particular $\nabla (\partial_i f)(x)\neq 0$ for some $i\in \{1,\ldots ,n\}$ and thus $F_1\subset \{x:\partial_if(x)=0\}$ which is a graph locally around $x$ and thus of dimension $n-1$.

The exceptional set is now $F_2=\{x:f(x)=0\wedge \nabla f(x)=0\wedge \nabla^2 f(x)=0\}$. Continuing this way the exceptional set $F_k$ where all derivatives up to order $k$ vanish is contained in a smooth submanifold of dimension $n-1$. What remains is the set of those points where all derivatives of all orders vanish, which is empty by assumption (otherwise by analyticity the function is identically zero).