$D$ is a fundamental discriminant if $D\equiv 1\pmod 4$ and $D$ is square-free or $D=4m,$ where $m\equiv 2,3 \pmod 4$ and $m$ is square-free.
On wikipedia I found the following characterisation: fundamental discriminants can be characterized by their factorisation into positive and negative prime powers. If we define the set $$S=\{-8,-4,8,-3,-5,-7,-11,13,\dots\}$$ where the prime numbers $\equiv 1\pmod4$ are positive and those $\equiv 3\pmod 4$ are negative. Then, $D\neq 1$ is a fundamental discriminant if, and only if, it is the product of pairwise relatively prime elements of S. However, unfortunately there is no reference given. Or is this just a trivial observation because in one case in order to have $D\equiv 1\pmod 4$ either the primes $\equiv 3\pmod 4$ have to come in even mutlipliciticity which is a contradiction against the square-freeness. So we have to take the negative of these primes. Same argument for the primes $\equiv 1 \pmod 4$ here taking the positive ones. Using a similiar argument One could argue that $-8,-4,8$ are the only possible even integers which satisfie $D=4m$ where $m\equiv 2,3 \pmod 4$ and $m$ squarefree.