Are you familiar with this theorem?
Theorem. (Kummer-Dedekind) Let $K$ be a number field with ring of integers $\mathcal{O}_K$, and let $Z[\alpha]$ be an order of $K$, defined by a integral generator of $K/\mathbb{Q}$. Let $f$ be the minimal polynomial of $\alpha$, $p$ a rational prime, and let $\overline{f}$ denote the reduction of $f$ modulo $p$. Let $\overline{f}=\overline{g}_1^{e_1}\cdots\overline{g}_k^{e_k}$ be the factorisation of $\overline{f}$ into powers of distinct irreducibles $\overline{g}_i\in(\mathbb{Z}/p\mathbb{Z})[x]$. Then:
The prime ideals of $\mathbb{Z}[\alpha]$ over $p$ are in bijection with the irreducible factors $\overline{g}_i$ of $\overline{f}$, where each factor $\overline{g}_i$ corresponds to a prime ideal $\mathfrak{p}_i=(p,g_i(\alpha))$, where $g_i\in\mathbb{Z}[x]$ is any lift of $\overline{g}_i$.
Writing $f=q_ig_i+r_i$, with $q_i,r_i\in\mathbb{Z}[x]$, the prime ideal $\mathfrak{p}_i$ is non-invertible if $e_i>1$ and $r_i\in p^2\mathbb{Z}[x]$.
$(p)\supseteq\mathfrak{p}_1^{e_1}\cdots\mathfrak{p}_k^{e_k}$, with equality if and only if all the $\mathfrak{p}_i$ are invertible. Then $p\nmid|\mathcal{O}_K:\mathbb{Z}[\alpha]|$, and $N(\mathfrak{p}_i)=p^{\deg(g_i)}$.
If $\mathfrak{p}_i$ is non-invertible, then $\frac{q_i(\alpha)}{p}\in\mathcal{O}_K\setminus\mathbb{Z}[\alpha]$.
Now this is probably considerably more than you need, but it's a useful theorem for computing a plethora of things, not just the prime ideals of $\mathcal{O}_K$, but also (along with some other useful results) class groups and class numbers.
So suppose that $I=(a,b)\lhd\mathcal{O}_K$. Then if a prime ideal $\mathfrak{p}\mid I$, then $a,b\in\mathfrak{p}$. Let $(p)=\mathfrak{p}\cap\mathbb{Z}$. Then by the multiplicity of the norm, $N(\mathfrak{p})$ (which is a power of $p$ by the above theorem) divides $N(a)$ and $N(b)$. This means that the primes dividing $I$ are above the rational primes dividing $\gcd(N(a),N(b))$, which gives you a finite list of primes to check.
Simplifying further, suppose that $\mathcal{O}_K=\mathbb{Z}[\alpha]$. Since you are primarily concerned with the quadratic case, for $K=\mathbb{Q}(\sqrt{d})$:
$$
\mathcal{O}_K=\begin{cases}
\mathbb{Z}[\sqrt{d}] & \text{ if }d\equiv 2,3\text{ mod }4 \\
\mathbb{Z}[\frac{1+\sqrt{d}}{2}] & \text{ if }d\equiv 1\text{ mod }4
\end{cases}
$$
So we can always write $\mathcal{O}_K$ in terms of a single integral element. Then find the possible $\mathfrak{p}=(p,g(\alpha))$. Then $\mathfrak{p}\mid I$ if and only if $a,b\in(\overline{g})\lhd(\mathbb{Z}/p\mathbb{Z})[\alpha]$. This can be checked by evaluating $a$ and $b$ under the homomorphism $\mathcal{O}_K\rightarrow(\mathbb{Z}/p\mathbb{Z})[\alpha]$ corresponding to $\mathfrak{p}$.
The only real difficulty comes when a prime $\mathfrak{p}$ has multiplicity greater than 1. But this is usually resolvable by using a norm argument.
Assuming it is question of a quadratic extension of number fields, $K/\Bbb Q$ is Galois, and a prime $p\in \Bbb Z=\mathcal O_{\Bbb Q}$ splits into $(P_1 P_2 \dots P_r )^e$ in $\mathcal O_K$ where the $P_i$ are distinct primes, all having the same inertial degree $f$
over $p$. Moreover $ref = [K : \Bbb Q ]=2$.
You listed all the possible splitting behaviours of $p\mathcal O_K$.
Now taking a random prime ideal $P\in \mathcal O_K$, it is not always of the form $p\mathcal O_K$ for a prime $p\in \Bbb Z$, as an example:
Take $K=\Bbb Q(i)$, and $P=(1-2i)$ is a prime of $\mathcal O_K$ lying over $5=(1-2i)(1+2i)$. But $P$ is not of the form $p\mathcal O_K$ for $p\in \Bbb Z$ prime.
Best Answer
Let $H$ be the class field of $K$ (in particular, it is totally real) and $p$ be a prime number that splits in $K$, write $p=PP’$. We have a canonical isomorphism $Gal(H/K) \cong Cl(K)$; fot this isomorphism, $P$ is trivial in $Cl(K)$ iff $P$ is totally split in $H$ iff $Frob_P \in Gal(H/K)$ is trivial.
Now $Frob_P\in Gal(H/K)$ is the element $g$ of this group such that $g$ preserves all primes of $H$ above $P$, and $g$ acts on the residue field at $P$ by $x \longmapsto x^{N(P)}=x^p$.
But $Frob_P \in Gal(H/\mathbb{Q})$ as well, and because $N(P)=p$, it is a Frobenius at one (any) of the primes of $H$ above $P$, so its conjugacy class is that of $Frob_p \in Gal(H/\mathbb{Q})$.
In other words, for primes $p$ totally split in $K$, the “splitting prime” is principal in $K$ iff $Frob_p \in Gal(H/\mathbb{Q})$ is trivial.
Let $C=\mathbb{Q}(e^{2i\pi/D})$, then $C \supset K$ and $C/K$ is abelian. Consider a prime $p$ totally split in $K$, and $P$ one of its factors. Then $Frob_p \in Gal(HC/\mathbb{Q})$ lies in fact in $Gal(HC/K)$ (which is abelian), and is a Frobenius at $P$.
Now, we have an injection $Gal(HC/\mathbb{Q}) \rightarrow Gal(H/\mathbb{Q}) \times (\mathbb{Z}/(D))^{\times}$, with image $U$, mapping $Frob_p$ to $Frob_p$ on the first coordinate and $p$ mod $D$ on the second one.
By Cebotarev, the conjugacy classes of images of Frobenius cover $U$. Note that $p$ being split in $K$ can be seen as a constraint on $p$ mod $D$ – let $S$ be the corresponding subgroup.
Your question thus amounts to: given $g,h \in U$, such that $p_2(g)=p_2(h)$ corresponds to a split prime, must we have $p_1(g)=e$ iff $p_1(h)=e$? The answer is yes iff for each $s \in S$, $p_1(p_2^{-1}(s) \cap U)$ is the identity iff it contains the identity.
In other words, if $U’ \subset U$ is the (abelian) image of $Gal(HC/K)$, when your answer is yes, $p_1(\ker{p_2})$ is trivial, and, by translation, $p_1$ is trivial on the fibers of $p_2$. This condition is also sufficient to yield a positive answer to your question.
In other words: your statement is equivalent to the following claim: in $Gal(HC/K)$, the class of an element in $Gal(C/K)$ determines the class of this element in $Gal(H/K)$, ie $Gal(HC/K) \rightarrow Gal(C/K)$ injective, is $H \subset C$.
In other words, when your statement holds, $H/\mathbb{Q}$ is abelian. But we have an exact sequence of groups $0 \rightarrow Cl(K) \rightarrow Gal(H/\mathbb{Q}) \rightarrow Gal(K/\mathbb{Q}) \rightarrow 1$ where the conjugation action is by $-1$ – in particular, if $H/\mathbb{Q}$ is abelian, then $Cl(K)$ is a $\mathbb{F}_2$-vector space.
So this shouldn’t work for the number field 2.2.229.1 (see the LMFDB – it is $\mathbb{Q}(\sqrt{229})$), and whose class field should be 6.6.12008989.1 (see the LMFDB again – it’s not spelled out but it has the right degree, signature and ramification). Maybe you can check this case?
A particular case where the result holds is when $O_K$ is a PID, so that $H=K$. This happens for many “small” real quadratic fields, which could be the cases that you’ve studied?