The Bohr-van Leeuwen theorem applies to an isolated system that cannot rotate (an isolated star could start rotating if exposed to a field) [REF].
The magnetic field does not contribute to the potential energy.