It is no obscure fact that North Korea is a major violator of human rights guidelines with its authoritarianism and poverty and is a major threat to world peace with its incessant nuclear weapons tests. Therefore, why is North Korea allowed to be part of the UN? Do the UN not have membership guidelines that directly oppose the kind of behaviour that North Korea partake in?
TLDR: No real law is opposed to their actions and expelling them would suit nobody
According to the UN charter, membership is open to
is open to all peace-loving States that accept the obligations contained in the United Nations Charter and, in the judgement of the Organization, are able to carry out these obligations
Realistically, the peace-loving is usually ignored in form of the alternative definition of sovereign state. This is largely because several permanent members of the UN Security Council can rightly be accused of not being peace loving (Russia in Crimea; America in Iraq/Afghanistan/Vietnam etc.; Britain in Iraq, Afghanistan etc.)
Indeed, possession of nuclear weapons in not regulated directly by the United Nations, again because if nuclear weapon tests and possession of missiles was a factor which disqualified you from being in the UN, every single permanent member of the Security Council and then some would get disqualified.
And technically speaking, the nuclear tests aren't outright illegal, since again nobody really wrote too many laws concerning the topic because the countries who possessed and wanted nuclear weapons were the primary authors of international law.
North and South Korea were simultaneously admitted to the UN in 1991 long before they started conducting nuclear tests in accordance with UN Security Council Resolution 702.
Now technically speaking North Korea could get expelled from the UN. Article 6 of the Charter describes as follows
A Member of the United Nations which has persistently violated the Principles contained in the present Charter may be expelled from the Organization by the General Assembly upon the recommendation of the Security Council.
This has never happened, and is unlikely to ever happen in the case of North Korea. This is because both Russia and China are permanent members of the UN security council, both of whose best interests are not served by expelling North Korea from the UN. To be fair no country's interests are best served by expelling North Korea from the UN, since suddenly you are cutting off dialogue and the possibility of negotiations to being an end to their nuclear program; as such if you refuse to negotiate a surrender of their nuclear program then the only option would be an invasion. An invasion that would result in catastrophic consequences (with or without nuclear weapons).
Basically, the United Nations is an international organisation and all independent and sovereign countries are members currently. Only states with limited recognition are not in the UN which includes Taiwan and Kosovo. The Vatican City and Palestine have both been an observer state.
So, since North Korea is recognised by the majority of countries and only doesn't have diplomatic relations with France, Japan, South Korea and the United States, it is a member of the UN.
In addition, even if North Korea violates UN rules and resolutions, it is hard to expel a member nation from the United Nations as it would require all 5 members of the Security Council to agree and China will likely veto any motion to expel the country.
Also, North Korea currently ignores international warnings and UN resolutions even though it's a member state. By expelling North Korea, it will have absolutely no reason to heed warnings issued by the UN.
In conclusion, it's not effective to expel North Korea from the UN, partly also due to the fact that it's difficult to expel a member nation.
You could argue the US is also
- a major violator of human rights (see Guantanamo)
- a major threat to world peace (see Illegal invasion of Iraq, Illegal war on Libya etc.)
and has produced more nuclear weapons than all other countries on earth combined. So, following your logic, the US should not be allowed to be part of the UN either. Not a fan of North Korea but you can't have it both ways.
It's better to have such a party at the table in a venue where these issues can be discussed with words, instead of leaving military conflict as their only channel for meaningful interaction with other countries. They do still have a (very slim) number of other options, but having more opportunities for diplomacy is generally better for peace than having less.