The UN publishes a list of recognised member states. ISO maintains a list of codes. IANA uses that list to determine whether a country code TLD is valid. But that's the extent of the UN's involvement in the governance of the root zone.
There are plenty of TLDs for areas which aren’t countries, whcih don’t claim to be counties, which nobody recognises as countries. .gg and .gu for example.
> The IANA is not in the business of deciding what is and what is not a country. The selection of the ISO 3166 list as a basis for country code top-level domain names was made with the knowledge that ISO has a procedure for determining which entities should be and should not be on that list.
Jon Postel, RFC 1591 (Domain Name System Structure and Delegation)