If $p_0$ is **not** a critical point of $f$ then the implicit function theorem states that, there exists local coordinates $(x^1,\dotsc, x^n)$, defined in an open neighborhood $U$ of $p_0$ in $\newcommand{\bR}{\mathbb{R}}$ $\bR^n$ such that, in these coordinates we have ($m=\dim X$) $$ x^i(p_0)=0,\;\;\forall i, $$ $$ X=\{ x^{n-m+1}=\cdots =x^n=0\}, $$ $$ f(x^1,\dotsc, x^n)=f(0,\dotsc,0)+x^m. $$ If you now define the (*non-Euclidean*) box $\newcommand{\ve}{\varepsilon}$ $$ B=\big\{ |x^i|< \ve;\;\;i=1,\dotsc, b\big\}. $$ In this neighborhood, that is *not* an Euclidean ball, the deformation you seek is obvious.