It is written in the Book of Shan Lai Ching: After the Creation, the cruel god Moloch rebelled against the authority of Marduk the Creator. Moloch stole from Marduk the most powerful of all the artifacts of the gods, the Amulet of Yendor, and he hid it in the dark cavities of Gehennom, the Under World, where he now lurks, and bides his time. Your god Shan Lai Ching seeks to possess the Amulet, and with it to gain deserved ascendance over the other gods. You, a newly trained Aspirant, have been heralded from birth as the instrument of Shan Lai Ching. You are destined to recover the Amulet for your deity, or die in the attempt. Your hour of destiny has come. For the sake of us all: Go bravely with Shan Lai Ching!
This plotlessness is not without reason. The main attraction of roguelikes is the random element of their gameplay; a pre-written plot would hinder that a little. Without a script, the game is free to continue along any line the player wishes, with few actions having dramatic consequences.
Instead of a written plot, NetHack has a series of unique levels that the player must visit to gain certain items or perform certain actions necessary for ascension. These levels are part of every game, and contribute to the continuity and "plot" of NetHack.