Ubaydallah ibn Muhammad al-Mahdi was an Abbasid prince and governor. Born in 771, he was a son of al-Mahdi, the 3rd Abbasid caliph, and Raytah, daughter of the dynasty’s 1st caliph, Abu al-Abbas al-Saffah. His full brother was Ali ibn Muhammad al-Mahdi, and he also had 10 half-siblings.
During the reign of his half-brother Harun al-Rashid, Ubaydallah became governor of Arminiyah and the northwestern provinces in 788/9, succeeding Yazid ibn Mazyad al-Shaybani. He later served 2 brief terms as governor of Egypt, in 795 and 796.
Ubaydallah died in Baghdad in 811. His nephew, the caliph al-Amin, led the funeral prayers.