Let $ K = \mathbf Q(\alpha) $ be a number field with ring of integers $ \mathcal O_K $, where $ \alpha $ is an algebraic integer with minimal polynomial $ \pi(X)$. Dedekind's factorization criterion tells us that if $ p $ is a prime which does not divide the index $ [\mathcal O_K : \mathbf Z[\alpha]] $, then the way $ \pi(X) $ splits modulo $ p $ is equivalent to the way $ (p) $ splits in $ \mathcal O_K $, in other words, if we have
$$ (p) = \prod_{i=1}^n \mathfrak p_i^{e_i} $$
in $ \mathcal O_K $ where the inertia degrees of $ \mathfrak p_i $ are $ f_i $, then we have
$$ \pi(X) \equiv \prod_{i=1}^n \pi_i(X)^{e_i} \pmod{p} $$
where the $ \pi_i $ are irreducible in $ \mathbf Z/p\mathbf Z[X] $ with $ \deg \pi_i = f_i $. This is essentially a consequence of the isomorphisms
$$ \mathbf Z[\alpha]/(p) \cong \mathbf Z[X]/(\pi(X), p) \cong \mathbf Z/p \mathbf Z[X]/(\pi(X)) $$
and the fact that you can read off the relevant data from the ring structure alone. As an example of how this fails when the criterion regarding the index is not met, consider $ K = \mathbf Q(\sqrt{5}) $. $ \mathbf Z[\sqrt{5}] $ has index $ 2 $ in $ \mathcal O_K $, and we have $ x^2 - 5 = (x+1)^2 $ in $ \mathbf Z/2\mathbf Z $, which suggests that $ 2 $ would be a totally ramified prime. However, this is not the case: $ \operatorname{disc} \mathcal O_K = 5 $, therefore $ 2 $ is not even a ramified prime in $ \mathcal O_K $. (This is a counterexample to your claim, since $ \mathbf Q(\sqrt{5}) $ is actually the splitting field of $ x^2 - 5 $ over $ \mathbf Q $. Note that $ \mathcal O_K $ is even a principal ideal domain!)