Let $p \in M$. Due to the normal form of smooth submersions, there are smooth chart $(U_p, y_p)$ of $M$, $(V_{f(p)}, x_{f(p)})$ of $N$, containing $p$ and $f(p)$, respectively, such that:
$$ x_{f(p)}\circ f \circ (y_p)^{-1}(z_1, \ldots, z_m) = (z_1, \ldots, z_n)$$
Then, it isn't hard to prove that for $i \in \left \{ 1, \ldots, n\right \}$
$$\mathrm{d}f_{p}\left ( \dfrac{\partial }{\partial y^i}\bigg|_{p} \right ) = \dfrac{\partial }{\partial x^i}\bigg|_{f(p)}$$
I'm not going to write down the subindex $p$ on the components of the charts, to not oversaturate notation.
On the other hand, since $X$ is a vector field, it has a representation in $V_{f(p)}$ of the form
$$ X = \sum\limits_{i=1}^{n}g_i^p \dfrac{\partial }{\partial x^i}\bigg|_{f(p)}$$
Afterwards, just define the vector field $Y^p:U_p \to TM$ by
$$Y^p = \sum\limits_{i=1}^{n}\left ( g_i^p \circ f\right ) \dfrac{\partial }{\partial y^i}\bigg|_{p}$$
It is straightforward that $Y^p$ is a smooth vector field and
$$\mathrm{d}f_p\left ( Y^p(q)\right ) = X(f(q)) \quad \forall q \in U_p$$
Therefore, we have constructed a family of local vector fields that satisfies the required condition. Now, consider a partition of unity $\left \{ \xi_p\right \}_{p \in M}$ subordinate to $\left \{ U_p\right\}_{p \in M}$ and define
$$ Y = \sum\limits_{p \in M}\xi_p Y^p $$
Finally, $Y$ is a global smooth vector field that is $f$-related to $X$.