In a $t$-test for difference in means, the null is usually specified as $\mu_X-\mu_Y = 0$ and the alternative hypothesis is EITHER $\mu_X-\mu_Y>0$, or $\mu_X-\mu_Y<0$. In any testing, we normally find the observed $t$-statistic, which we call $t^*$, and then compared it using the p-value, defined as:
$$ P(t^*>t|H_0) $$
where it is defined to be the probability of observed a $t$-statistic as extreme as the one we observed from the data, GIVEN we are under the null distribution. This p-value corresponds normally to the right-tailed test, where the alternative is $\mu_X-\mu_Y>0$. For the case where $\mu_X-\mu_Y<0$, our p-value then becomes $P(t^*<t|H_0)$.
My question then is: why does $\mu_X-\mu_Y>0$ translate to finding the probability of the $t$-statistic being greater than some observed $t$ under the null distribution and vice versa? I understand that the statistic itself, $\mu_X-\mu_Y>0$ has direction, but why does it translate to $t^*$ having that direction too? Is it by the fact dividing by the standard deviation is dividing by something positive and hence directions are preserved?
Meaning, the statistic $\mu_X-\mu_Y$ is invariant in terms of sign due to the standard deviation being a positive value?