Assume $f$ is unramified. Then $f$ is DM hence we can choose algebraic spaces $U$, $V$, a smooth surjective morphism $V \to \mathcal{Y}$ and a surjective \'etale morphism $U \to \mathcal{X} \times_\mathcal{Y} V$ (Lemma \ref{lemma-DM}). Since $f$ is unramified the induced morphism $U \to V$ is unramified. Thus $U \to V$ is locally of finite type (Morphisms of Spaces, Lemma \ref{spaces-morphisms-lemma-unramified-locally-finite-type}) and we conclude that $f$ is locally of finite type. The diagonal $\Delta : \mathcal{X} \to \mathcal{X} \times_\mathcal{Y} \mathcal{X}$ is a morphism of algebraic stacks over $\mathcal{Y}$. The base change of $\Delta$ by the surjective smooth morphism $V \to \mathcal{Y}$ is the diagonal of the base change of $f$, i.e., of $\mathcal{X}_V = \mathcal{X} \times_\mathcal{Y} V \to V$. In other words, the diagram $$ \xymatrix{ \mathcal{X}_V \ar[r] \ar[d] &  \mathcal{X}_V \times_V \mathcal{X}_V \ar[d] \\ \mathcal{X} \ar[r] & \mathcal{X} \times_\mathcal{Y} \mathcal{X} } $$ is cartesian. Since the right vertical arrow is surjective and smooth it suffices to show that the top horizontal arrow is \'etale by Properties of Stacks, Lemma \ref{stacks-properties-lemma-check-property-weak-covering}. Consider the commutative diagram $$ \xymatrix{ U \ar[d] \ar[r] & U \times_V U \ar[d] \\ \mathcal{X}_V \ar[r] & \mathcal{X}_V \times_V \mathcal{X}_V } $$ All arrows are representable by algebraic spaces, the vertical arrows are \'etale, the left one is surjective, and the top horizontal arrow is an open immersion by Morphisms of Spaces, Lemma \ref{spaces-morphisms-lemma-diagonal-unramified-morphism}. This implies what we want: first we see that $U \to \mathcal{X}_V \times_V \mathcal{X}_V$ is \'etale as a composition of \'etale morphisms, and then we can use Properties of Stacks, Lemma \ref{stacks-properties-lemma-check-property-after-precomposing} to see that $\mathcal{X}_V \to \mathcal{X}_V \times_V \mathcal{X}_V$ is \'etale because being \'etale (for morphisms of algebraic spaces) is local on the source in the \'etale topology (Descent on Spaces, Lemma \ref{spaces-descent-lemma-etale-etale-local-source}). \medskip\noindent Assume $f$ is locally of finite type and that its diagonal is \'etale. Then $f$ is DM by definition (as \'etale morphisms of algebraic spaces are unramified). As above this means we can choose algebraic spaces $U$, $V$, a smooth surjective morphism $V \to \mathcal{Y}$ and a surjective \'etale morphism $U \to \mathcal{X} \times_\mathcal{Y} V$ (Lemma \ref{lemma-DM}). To finish the proof we have to show that $U \to V$ is unramified. We already know that $U \to V$ is locally of finite type. Arguing as above we find a commutative diagram $$ \xymatrix{ U \ar[d] \ar[r] & U \times_V U \ar[d] \\ \mathcal{X}_V \ar[r] & \mathcal{X}_V \times_V \mathcal{X}_V } $$ where all arrows are representable by algebraic spaces, the vertical arrows are \'etale, and the lower horizontal one is \'etale as a base change of $\Delta$. It follows that $U \to U \times_V U$ is \'etale for example by Lemma \ref{lemma-etale-permanence}\footnote{It is quite easy to deduce this directly from Morphisms of Spaces, Lemma \ref{spaces-morphisms-lemma-etale-permanence}.}. Thus $U \to U \times_V U$ is an \'etale monomorphism hence an open immersion (Morphisms of Spaces, Lemma \ref{spaces-morphisms-lemma-etale-universally-injective-open}). Then $U \to V$ is unramified by Morphisms of Spaces, Lemma \ref{spaces-morphisms-lemma-diagonal-unramified-morphism}.