Why is up spin in the px orbital and down spin in the py orbital considered an excited state?
Hund's rule of maximum multiplicity states that for a given electron configuration, the term with the lowest energy has a maximum multiplicity $2S+1$. $S$ is the total spin angular momentum of all electrons in the partially-filled subshell.

For the application of the rule, we consider the 2 electrons in the $p$ subshell and add up their spin quantum numbers to obtain $S$ and the multiplicity. For the ground state configuration, with both electrons "spin-up", we get

$$S=+\frac{1}{2}+(+\frac{1}{2})=1$$
$$2S+1=3$$

For your proposed configuration with one $p$ electron "spin-up" and the other one "spin down":

$$S=+\frac{1}{2}+(-\frac{1}{2})=0$$
$$2S+1=1$$

Since the multiplicity value is smaller, this configuration is not the one which is lowest in energy, and therefore cannot be regarded as the ground state.