North Korea (DPRK) officially follows an ideology developed by its founder, Kim Il Sung, known as KimIlSungism (really), which his just deceased son continued to follow, and which it is likely will continue to be followed at least for awhile by his grandson, the Great Successor, Kim Jong Un. Besides generally following the Stalinist version of strict command planned socialism, somewhat loosened in recent years, the most famous aspect of KimIlSungism has been its doctrine of self-reliance, or juche (also transliterated as chuch'e). While some of the poverty of the DPRK is clearly due to its overemphasis on military production (fourth largest military in the world, and check out those nukes) and the typical stagnation of command planning, much is almost certainly due to the nearly autarkic approach due to KimIlSungism. Where did it come from? I see at least five sources.
The first is the Stalinist model itself. In the great struggle with Trotskyism, Stalin advocated "socialism in one country," although, of course, the Soviet Union was the largest nation in the world by far in land area. However, after WW II, this would be less emphasized as Eastern Europe went officially command socialist with the assistance of the Red Army in place. But in the DPRK, Kim Il Sung would cling to the older model.
Second is that after the death of Stalin, Kim would find fault even before Mao did to the moves towards thawing and loosening of the model that was going on in the Soviet Union. The first recorded speech of Kim supporting juche occurred in late 1955, prior to Khrushchev's 1956 deStalinization speech that reportedly upset Mao (according to official DPRK histories, Kim Il Sung gave his first pro-juche speech in 1930 at age 18, but no independent evidence supports this). With the failure of North Korea to conquer South Korea, and truce without official peace treaty after Stalin's death in 1953, the new leaders would go even softer with the Geneva summit in 1955, accepting the reunification of Austria, guaranteed to be neutral, a model possibly there for Korea that Kim rejected.
Third was the emergence of the Sino-Soviet conflict after 1956, although it would be a few years before this would become open and a problem for the DPRK, caught between the two. While Kim tended to side with Mao's critique of Khrushchev's ideological and policy deviations from Stalinism, he also disagreed with the more decentralized and agriculturally oriented version of socialism that Mao followed in China. As the conflict worsened, he wished to keep independent from both of them, which encouraged the idea of self-reliance. He also did not wish to go the capitalist road or fall into dependence on the capitalist West (or worse yet, Japan), so self-reliant juche became the way to go and was gradually developed over a long period.
Fourth was the emergence of his desire for a socialist monarchy, with his son to succeed him. Having a distinct ideology of self-reliant socialism fit in with this (and it is curious that some other dictatorships have followed the same path of de facto monarchy even if officially socialist republican, see Syria). Curiously, this is also consistent with traditional Confucian values of respect for family.
And the fifth involves the DPRK also falling back on traditional Korean attitudes and practices. Not only has Korea long been described as the most Confucianist nation, but prior to the Japanese conquest in 1910, it was also the most isolated, known as the Hermit Kingdom. In this it had long imitated Japan, but continued to resist being "opened up" even after Japan was by Commodore Perry's black ships in the 1850s, leaving it to the Japanese themselves to do the opening. Kim, of course, presented himself as the national hero of the anti-Japanese resistance, and this return to a traditional Korean practice burnished his credentials as the truly genuine national Korean leader who deserved to lead the unified nation.