From Wikipedia:
There is a lack of evidence for a saviour figure, such as the Mahdi, being part of the teachings of Islam during the life of Muhammad (570-632): neither the Quran nor early Hadith collections make explicit reference to the Mahdi. However, within half a century of Muhammad’s death, the figure of the Mahdi was part of Islamic belief. It may be that the concept of the Mahdi was derived from messianic Judeo-Christian beliefs.[5][6]
How likely is it that the concept of a Mahdi in Islam was derived from messianic Judeo-Christian beliefs?
Well, I'm cautious to use the word impossible, but the thing is, Islam holds the exact same messianic view as Christianity in that Isa pbuh (Jesus) IS THE MESSIAH. And according to Islamic Eschatology, he will return at the end of times to slay the Anti-Christ. In that same eschatology, the Imam Mahdi will aid and set the stage for the Messiah. The point is, they are separate figures. So it's kinda silly to say the Mahdi is inspired by the Christian Messiah in Islam, when the Christian Messiah actually is the same one in Islam.
Also, it's important to note that as far as messianic views go, it's Judaisim that's the odd one out between the 3.