The five Pandavas with their wife Draupadi and brothers climb the Himalayas; all of them except Yudhishthira and his dog perishing along the way.[10] Then Yudhishthira meets Indra, King of the gods, who welcomes him to heaven but tells him he has to leave his dog behind.[10][11] Yudhishthira refuses to enter heaven without his dog and says he will go back to earth.[10][12][13] The dog disappears and it is replaced by Yama, the god of death; Indra is impressed by his actions and then his righteousness opens the gates of heaven for Yudhishthira.
I am not studied in this. But the version from “Great Masters of the Himalayas,” I liked better.
Beside King Yodhastar crouched his dog, faithful companion of the terrible journey. “May I take my dog into heaven with me?” he asked Truth.
“No! Your dog must live many lives on this earth. When he reaches your state he may enter Bhramakand, but not now.”
The King remonstrated that the dog followed him in his perilous search for Truth, had endured all the hardships and surely should be permitted to share in the reward. “My wife and my brothers failed me [in this version, some of them died on the way and some gave up and left him] but not this dog,” he added.
“Let us go,” God spoke sternly.
King Yodhastar pleaded to be allowed to take his dog but Truth was obdurate. “This is not just or right!” the King cried. “I came hither for you, Truth, not for your Heaven and if I cannot take my poor dog who shared the pain and should share the joy of reward with me I shall not enter your Heaven. Nor do I think you just and merciful, you, the God of Love and Justice are doing the works of darkness. I shall remain with my dog.” Thus spoke the valiant king.
“Look, King, at your dog,” was the compassionate answer. There was no dog to be seen!
“That, good King, was your last test. You have triumphed over all. Now come with me.”