Consider $Y = \mathbb{N} \cup \{ \infty\}$ and $X = \{ \frac{1}{n}\mid n \in \Bbb N\} \cup \{0\}$

$f:(Y,d_Y) \to (X,d)$ is an isometry by definition. Here $d$ is the usual metric on $X$ inherited from $\Bbb R$. Also a bijection so it's a homeomorphism.

Any topological fact about $X$ will also be true of $Y$ and vice versa. $X$ is compact and so is $Y$. All points in $X$ except $0$ are isolated and the same is true for all points except $\infty$ in $Y$ etc. $X$ and $Y$ are both instances of the one point-compactification of a countable and discrete space.