Name in Japanese M Mahdi
This is the common, natural katakana for Mahdi. Katakana approximates English sounds, so a slightly different spelling can also be valid — treat this as a reliable default, not the single "correct" answer.
Read it one katakana at a time:
Full reading: Mafudi
In Japanese, foreign names are written in katakana — the angular script reserved for words borrowed from other languages. So on a form, a name tag, a delivery slip or a news article in Japan, Mahdi appears as マフディ. This is the correct and respectful way a non-Japanese name is represented; it is not a kanji "translation". A Japanese reader sees マフディ and immediately reads it by its sound, Mafudi.
Katakana is a syllabary, so English sounds are fitted to the nearest Japanese syllables and every consonant (except ん) is followed by a vowel. That is why Mahdi becomes マフディ rather than a letter-for-letter copy. More than one katakana spelling can be reasonable for the same name, which is why we flag whether a spelling is a long-established one or a natural default.