[step:Use infinitude of $k$ to rule out nonzero polynomials vanishing everywhere]
We use the following elementary polynomial identity lemma.
[claim:Polynomial identity lemma over an infinite field]
Let $m\in \mathbb N$. If $F\in k[x_1,\dots,x_m]$ satisfies $F(a)=0$ for every $a\in k^m$, then $F=0$.
[/claim]
[proof]
If $m=0$, then $k[x_1,\dots,x_m]=k$. A constant $F\in k$ vanishes at the unique point of $k^0$ precisely when $F=0$.
Assume $m\ge 1$. We argue by induction on $m$. For $m=1$, a nonzero polynomial in $k[x_1]$ has degree $d\ge 0$ and has at most $d$ roots in the field $k$. Since $k$ is infinite, it cannot vanish at every element of $k$. Hence a polynomial in $k[x_1]$ vanishing on all of $k$ must be zero.
Now assume the result holds for $m-1$, where $m\ge 2$. Write $F$ as a polynomial in $x_m$ with coefficients in $k[x_1,\dots,x_{m-1}]$:
\begin{align*}
F=\sum_{j=0}^d F_j x_m^j
\end{align*}
for some integer $d\ge 0$ and coefficient polynomials $F_j\in k[x_1,\dots,x_{m-1}]$. Fix $b=(b_1,\dots,b_{m-1})\in k^{m-1}$. Define the one-variable polynomial $F_b\in k[x_m]$ by
\begin{align*}
F_b(x_m):=F(b_1,\dots,b_{m-1},x_m).
\end{align*}
By hypothesis, $F_b(t)=0$ for every $t\in k$. The one-variable case gives $F_b=0$, so each coefficient satisfies $F_j(b)=0$. Since this holds for every $b\in k^{m-1}$, the induction hypothesis gives $F_j=0$ for every $j$. Therefore $F=0$.
[/proof]
Suppose first that $I(Y)=(0)$. Then $V(I(Y))=V((0))=k^n$, because the zero polynomial vanishes at every point of $k^n$. Hence $Y$ is dense by the previous step.
Conversely, suppose $Y$ is dense. Then $V(I(Y))=k^n$. Let $f\in I(Y)$. Since $V(I(Y))=k^n$, the polynomial $f$ vanishes at every point of $k^n$. By the polynomial identity lemma over the infinite field $k$, applied with $m=n$ and $F=f$, we get $f=0$. Hence every element of $I(Y)$ is zero, so $I(Y)=(0)$.
[/step]