I was going to let this one lie as well, but people keep commenting with incorrect statements about constructive mathematics. So...
Here is a formalization of Euclid's proof that the prime numbers are list avoiding (see below) in Agda. It uses machinery that the Agda standard library already had for calculating prime factorizations. Agda is constructive. The only way you can use classical reasoning is with an explicit hypothesis or by adding a postulate, the latter of which would cause errors with the --safe flag enabled. If you decide to try it out yourself, you'll see it has neither.
I simplified the argument a bit, too (at least, relative to what wikipedia gives). You can always just consider the first element in the prime factorization, because it can't divide the product of the original list, by Euclid's argument. If $1 + \prod_i^n p_i$ is prime, then it will just happen to be the only element of the prime factorization (but we don't actually care).
After that, I use a formalization of three different notions of 'infinite' to show that primes satisfy all three. They are:
- 'list avoiding' - there is a map from lists of values to values not in the list
- 'infinite'1 - there is an injection from the natural numbers to the type
- 'not finite' - there is no (finite) list that contains all values
I believe they are listed above in order of decreasing constructive strength. Every list avoiding type is infinite, and every infinite type is not finite, as demonstrated in that file (although the latter just appeals to the proof already in the standard library). This is all constructive.
It is just not correct to say that 'negative' statements are not constructive. Constructively, negation is usually defined as $¬P = P → ⊥$, where $⊥$ is the trivially false proposition. Proving a negative statement $¬P$ 'by contradiction' by e.g. showing that $P → Q$ and $P → ¬Q$, is just modus ponens. You can also look at it as negation introduction being fine, even though double negation elimination is (in general) not. This distinction is often not taught well (or at all), but it is significant.
I suppose one could say that proofs of negatives do not construct numbers, and this is true. But, for instance, proofs of $∀$ statements do not construct numbers for the quantifier, either. Proofs of negatives and $∀$ are supposed to accept an input and demonstrate something based on it, not produce a number.
Even stronger, it makes little sense to claim that infinitude of primes is not provable constructively because, as mentioned, the usual arguments prove something that is better suited to be the meaning of 'infinite' constructively than simply 'not finite.' What is often the case in constructive mathematics is that negative statements are weak. From knowing that a type is, 'not finite,' we cannot necessarily enumerate distinct values, or find a value distinct from some that are given.2 But Euclid's argument does prove that these are possible.
Lastly, just because excluded middle is not assumed to be a valid reasoning principle does not mean that it is false.3 What it means is that any instances you want to use must be proved. For many statements in number theory, their instance of excluded middle is provable using induction, or consequences thereof. This corresponds roughly to the statement being decidable by recursive algorithms. And of course, this includes primality, as mentioned in the comments.
[1] This is the typical constructive definition of, "infinite," because "not finite" is less useful. Just because "infinite" sounds negative doesn't mean it is actually taken to be a negated proposition. For instance, "inconsistent," is usually the positive statement, "there is a proof of ⊥," and, "consistent," is its negation.
[2] In cases like primality that are decidable, these notions of infinitude collapse somewhat. Depending on what principles you consider constructive, they might all be equivalent for decidable subsets of $ℕ$ (though not in general).
[3] In fact, excluded middle is provably not false in constructive mathematics. Both $¬¬(P ∨ ¬P)$ and $¬¬(¬¬P → P)$ are intuitionistic theorems.