[guided]Assume that the image $f(X)$ has finite diameter in $Y$. We name this finite bound:
\begin{align*}
M:=\operatorname{diam}_Y(f(X)).
\end{align*}
The definition of diameter says that $M$ is a uniform upper bound for the distances between all pairs of points in $f(X)$. Since $f(x)$ and $f(x')$ belong to $f(X)$ for every $x,x'\in X$, we have
\begin{align*}
d_Y(f(x),f(x'))\leq M
\end{align*}
for every $x,x'\in X$.
To prove that $f$ is Lipschitz, we need a constant multiplying $d_X(x,x')$. Some definitions allow a Lipschitz constant to be $0$, while others require it to be positive, so we choose a positive constant that always works:
\begin{align*}
C:=\max\{M,1\}.
\end{align*}
Then $C>0$ and $M\leq C$.
Now let $x,x'\in X$. There are two cases, and this is exactly where the discrete metric is used. If $x=x'$, then $f(x)=f(x')$, so
\begin{align*}
d_Y(f(x),f(x'))=0.
\end{align*}
Also $d_X(x,x')=0$, hence
\begin{align*}
d_Y(f(x),f(x'))=0=C\,d_X(x,x').
\end{align*}
If $x\neq x'$, then the discrete metric gives $d_X(x,x')=1$. The finite diameter bound gives
\begin{align*}
d_Y(f(x),f(x'))\leq M.
\end{align*}
Since $M\leq C$, we obtain
\begin{align*}
d_Y(f(x),f(x'))\leq C=C\,d_X(x,x').
\end{align*}
In both cases,
\begin{align*}
d_Y(f(x),f(x'))\leq C\,d_X(x,x').
\end{align*}
This is precisely the Lipschitz condition for the map $f:X\to Y$, so $f$ is Lipschitz.[/guided]