We give a fairly formal statement and proof of the result described in the post.
Theorem: Let $a$ and $b$ be integers, with $b\ne 0$. Suppose that $\frac{a}{b}$ has a rational square root. Then there exists an integer $e$, and integers $m$ and $n$, such that $a=em^2$ and $b=en^2$,
Proof: It is enough to prove the result for positive $b$. For if $b$ is negative and $\frac{a}{b}$ has a square root, then we must have $a\le 0$. Thus $\frac{a}{b}=\frac{|a|}{|b|}$. If we know that there are integers $e$, $m$, $n$ such that $|a|=em^2$ and $|b|=en^2$, then $a=(-e)m^2$ and $b=(-e)n^2$.
So suppose that $b\gt 0$, and $a\ge 0$. Let $d$ be the greatest common divisor of $a$ and $b$. Then $a=da^\ast$, and $b=db^\ast$, for some relatively prime $a^\ast$ and $b^\ast$.
It will be sufficient to prove that each of $a^\ast$ and $b^\ast$ is a perfect square.
Since $\frac{a^\ast}{b^\ast}$ is a square, there exist relatively prime integers $m$ and $n$ such that $\frac{a^\ast}{b^\ast}=\left(\frac{m}{n}\right)^2$.
With some algebra we reach
$$a^\ast n^2=b^\ast m^2.$$
By Euclid's Lemma, since $b^\ast$ divides the product on the left, and is relatively prime to $a^\ast$, we have that $b^\ast$ divides $n^2$. Also, because $n^2$ divides the expression on the right, and $n^2$ is relatively prime to $m^2$, we have $n^2$ divides $b^\ast$. Since $b^\ast$ is positive, we conclude that $b^\ast=n^2$. Now it is easy to show that $a^\ast=m^2$.
A similar theorem can be stated and proved for $k$-th roots.