You can always write your polynomial as
$$
P(x,y) = \sum_{i=0}^n p_i(x) \cdot y^i
$$
for suitable polynomials $p_i$.
Let $M = \{(x,y) \mid P(x,y) = 0\}$. Note that $M$ is closed, hence measurable.
By Fubini's theorem, we have
$$
\lambda_2(M) = \int \lambda_1 (M_x) \, dx,
$$thus
where $M_x = \{y \mid (x,y) \in M\} = \{y \mid P(x,y) = 0\}$.
It thus suffices to show $\lambda_1 (M_x) = 0$ for almost all $x$.
If $M_x$ is not a null-set, this implies that the polynomial(!) $p(x, \cdot)$ has infinitely many roots and is hence constant $0$.
If this happens for infinitely many $(x_n)_n$, we see $$0 \equiv p(x_n, y) = \sum_{i=0}^n p_i(x_n) \cdot y^i$$ for all $n$ and each $y \in \Bbb{R}$. But this implies $p_i(x_n) = 0$ for all $i$ and $n$. Thus, the polynomial $p_i$ has infinitely many roots, i.e. $p_i \equiv 0$ and thus $p \equiv 0$, a contradiction.
We can hence only have $\lambda_1 (M_x) > 0$ for finitely many $x$, proving $\lambda_2 (M) = 0$.
Exercise: Generalize this to arbitrary dimensions.