Ahmad b. Ishaq says: "I went into the presence of Imam Askari ... who said:
... O, Ahmad b. Ishaq! HE [HAZRAT MAHDI (AS)] IS LIKE KHIDR (AS) AND DHU’L- QARNAYN (AS) IN THIS COMMUNITY... (Sheikh al-Saduq, Kamal al-Din, Vol. 2, p. 384; Abdullah Turan, Hz. Mehdi Aleyhisselam [Hazrat Mahdi (as)], Al-i Taha Press, p. 157)
The information provided in the hadith shows that the stories in the Qur’an about Khidr (as) and Dhu’l-qarnayn (as) are also applicable by analogy to Hazrat Mahdi (as).
It accordingly appears that Hazrat Mahdi (as) will have Khidr’s (as) moral values and manners, will have his knowledge of the consciousness of Allah and will act in the light of that knowledge.
In addition, in the story of Khidr (as) in the Qur’an, in the same way that the Prophet Moses (as) reacted in ignorance of the wisdom behind Khidr’s (as) actions, so in the End Times people will be unable to properly understand and appreciate the Hazrat Mahdi (as), who will act out of knowledge of the consciousness of Allah. People will misunderstand the Hazrat Mahdi (as) and will therefore react very strongly to him. In fact, however, all of Hazrat Mahdi’s (as) actions will be full of secret knowledge and wisdom as a blessing from Allah.
In another hadith of our Prophet (saas) it is also revealed that from start to finish the story of Kahf refers, analogically, to Hazrat Mahdi (as), who will free mankind from the corruption of the antichrist. The hadith above and all those below regarding the story of Kahf regarding the End Times show that Hazrat Mahdi (as) will rule the world like Dhu’l-qarnayn (as), who is described in the story of Kahf:
Whoever of you lives to see the antichrist, LET HIM READ THE BEGINNING OF SURA AL-KAHF IN HIM, the end of this sura is your salvation from the corruption of the antichrist. (Sunan Abu Dawud, 5/121)