I'd like to propose a slightly different approach. We will assume that $I$ is nontrivial (obvious task) and finite (without loss of generality).
We will construct a continuous (nondecreasing) function $f$ from $I$ to some interval $J$ and $f$ will be constant exactly on the equivalence classes of $\simeq$. It will turn out that $\tilde{f}:\ I/\simeq \ \to \ J$ is a homeomorphism.
Let's define $i(x) = [a,b]$, where $[a,b]$ is the maximal interval such that $x\in [a,b]$ and $\gamma|_{[a,b]}$ is constant. The definition is correct, because $X$ is a metric space (that's the only place where we use any assumptions about $X$ - actually we use only the fact that $X$ is a $T_1$ space).
Edit: Nitpick: if $I\neq[k,l]$, then the first and/or the last (ordered by their beginnings) interval $i(x)$ may be of the form $(a,b]$ and/or $[a,b)$ respectively (or even $(a,b)$ if $\gamma$ is constant). From now on, I will just write $[^*a,b]^*$. End of edit.
Let $In$ be the set of all nontrivial intervals $i(x)$: $In = \{i(x)\ |\ x\in I \} \setminus \{[a,a]\ |\ a\in I\}.$ $In$ is of course a countable set and we can enumerate its elements with natural numbers $In = \{in_1, in_2, \ldots \}$.
Our function will be constructed almost like the Cantor function. Let's start with a linear homeomorphism $f_0: I \to [^*0,1]^*$ (the increasing one, $[^*0,1]^*$ interval is open/closed just like $I$). Now, take the first interval $in$ from $In$ and define $f_1$ in the same way as in the case of the Cantor function. From now on, interval $in$ is 'used' which will be informally denoted by $in\in Used$.
Here the technical part starts. I recommend skipping it and the 'excercise ($\heartsuit$)' requiring those technical details during the first reading. $I \setminus \bigcup Used$ is a sum of distinct open (in $I$) intervals. For each such interval $[^* a,b]^*$ we look for an interval $in \in In \setminus Used$ such that $in \cap (a+\frac{b-a}{4}, b - \frac{b-a}{4}) \neq \emptyset$. If such $in$ exists, then we use it to define the next $f_n$ and add to $Used$. Otherwise we take the maximal open interval (a',b')\subseteq(a,b)\setminus \bigcup In and add [a',b'] to the $Used$ set.
After finishing the job for all intervals $[^*a,b]^*$ we use the next unused $in \in In$ (to ensure that all the intervals from $In$ will be used) like in the standard construction and repeat the previous step. More precisely - we take the maximal $[^*c,d]^* \subseteq I \setminus \bigcup Used$ containing $in$ and change the values of $f_n$ on $[^*c,d]^*$ in the standard way getting $f_{n+1}$.
Edit: It may be hard to prove that the above construction can always be continued - if $in$ happens to be the whole $[^* a,b]^*$, then we can't continue. So we want $in$ to be inside one of the intervals of $I\setminus Used$. To guarantee that, at the very beginning we use the first and the last interval (ordered by their beginnigs) if they exist (that's the moment responsible for ending up with a degenerated $J$). Later, when adding [a',b'] to the $Used$ set, we check if there is unused $in^1$ with its end in a' or $in^2$ with its beginning in b' and add to $Used$ the whole in^1 \cup [a',b'] \cup in^2 instead of just [a',b'] (and change $f_n$ appropriately). End of edit.
It is not hard to notice that $f_n$ is nondecreasing and $(f_n)$ is a Cauchy sequence in the supremum norm. Consequently it converges to a nondecreasing map $f: I \to [^*0,1]^*$.
$f$ is constant on all the equivalence classes of $\simeq$, so it can be interpreted as a surjective function $\tilde{f}:\ I/\simeq \ \to \ J$ for some interval $J \subseteq [0,1]$. We are almost there, but we don't know yet if $\tilde{f}$ is a homeomorphism.
What we need to finish the proof is that $f$ a) takes different values for arguments belonging to different equivalence classes and b) is open. From a) we know that $\tilde{f}$ is injective so there is $\tilde{f}^{-1}$. From b) we know that $\tilde{f}$ is open so $\tilde{f}^{-1}$ is continuous, so $\tilde{f}$ is homeo.
Both a) and b) follow from the fact that $f(x)\lt f(y)$, whenever $x \lt y$ and not $x \simeq y$ - I left it as an easy excercise ($\heartsuit$).
a) follows easily from the above, for b) we need to notice what the quotient topology $\tau_{I / \simeq}$ is. $\tau_{I / \simeq} \ = \ \{ U/\simeq \ | \ U\in\tau_I \} \ = \ \{ U/\simeq \ | \ U\in\tau_I, \bigcup_{x\in U} i(x) \subseteq U \}$ It is generated by $B=\{ [^*a,b]^*/\simeq \ | \ [^*a,b]^*\in\tau_I, \bigcup_{x\in [^*a,b]^*} i(x) \subseteq [^*a,b]^* \}$ It can be easily checked that $f(b)$ is an open (in $J$) interval for $b\in B$, which guarantees that $f$ is open and finishes the whole proof.