Is "British" a noun or an adjective in "British PM"?

This is just headliner confusion. British is virtually always an adjective, not a noun. The noun is Britain. But headlines of late have been using the shorter noun forms, as in Spain court in lieu of Spanish court. I wouldn’t recommend it outside of headlines, if even there.

Be that as it may, we aren’t going to start calling British, French, German, Spanish, Chinese, or Japanese “nouns” just because their corresponding noun forms are now getting used as noun-adjuncts in headline English.

One example of British as a noun might be:

We haven’t seen many British around here lately.

Although another is:

We haven’t seen many Britishers around here lately.

Neither of those is particularly well thought of. In writing, Briton is usually preferred:

We haven’t seen many Britons around here lately.

But that can of course be misheard in speech as:

We haven’t seen many *Britains around here lately.

Which is one reason why it tends to be shorted to the casual:

We haven’t seen many Brits around here lately.