Let $K\subset L=K(\gamma)$, ($\gamma$ an algebraic integer) be number fields such that there exists a $k\in \mathcal O_K$ and some $n\in\Bbb N$, $\gamma^n=k$. Also, there exists an ideal $I\subset \mathcal O_K$ such that $(k) = I^n$. Show that a prime $\mathfrak p \subset \mathcal O_K$ ramifies in $L$ only if it divides $n$.
Partial results: let $\mathfrak p$ be ramified. Then, using that the discriminant $D$ of $L/K$ divides the discriminant of $f(x) = x^n - \gamma$, I can get that $\mathfrak p|N(n\gamma^{n-1})$. If $I$ is principal, then the problem reduces to the cyclotomic case which is also easy. Therefore we can assume that $I$ is not principal and $\gcd(h_K,n)>1$.
However, I don't know any relation between the class number and how primes ramify and can't finish the proof from here on.
Ramification is a local condition, so we reduce to the case that $L/K$ is a finite extension of local fields. Then, using your notation, $k = u \cdot \pi_K^\ell$ for some unit $u \in \mathcal{O}_K^\times$ and $\ell \in \mathbf{Z}_{\geq 0}$, where $\pi_K$ is a uniformizer. The condition $(k) = I^n$ for some ideal $I$ implies that $n \mid \ell$, so $L$ is obtained by adjoining an $n$th root of $u$. Moreover, if the residue characteristic doesn't divide $n$ this is an unramified extension.