I mean “compete” in the economic sense here.
The answer to the question in the title is no.
It’s common to claim that the answer to this question is yes, and I suggest that a lot of policy mistakes are made because of that.
What governments actually do is keep score – usually with GDP, but also with stuff like trade deficits/surpluses, and balance of payments. They also judge winners and losers (both countries and policies) based on those scores.
Firms clearly compete with each other, even across borders. People do to, but perhaps not as seriously.
But, countries are not single entities for the purposes of most economic decisions. Instead they are collections of things we count together as a group.
When we talk about a country competing with another country, what we are really talking about is a multitude of individual competitions that probably are not managed by “the country”.
This is akin to claiming that a country won the Olympics. People do this, but we all know it’s kind of child-like to believe this claim.
Unfortunately, when it comes to macroeconomics, many people don’t think twice about this mistake. This is why trade protectionism is an easy sell to voters: “our team” is going to (actively) do something to “their team”. This is in spite of the fact that trade protections are largely transfers from our consumers to our producers.