Ubaydallah ibn Muhammad al-Mahdi () (771âÂÂ810/11) was an Abbasid prince. He was the son of al-Mahdi, the third caliph of the Abbasid Caliphate, and Raytah, daughter of the first Abbasid caliph Abu al-Abbas al-Saffah.
In 761, the future caliph al-Mahdi married Raytah as his first wife after his return from Khurasan. She was the daughter of al-Saffah and his wife Umm Salamah, a Makhzumite. Raytah gave birth to two sons, Ubaydallah and Ali.
During the reign of his half-brother Harun al-Rashid (), Ubaydallah was appointed as governor of Arminiyah and the northwestern provinces in 788/9, succeeding Yazid ibn Mazyad al-Shaybani. He was later appointed to two brief stints as governor of Egypt, in 795 and 796.
In 810 or 811 Ubaydallah died in Baghdad. His nephew al-Amin led the prayers at his funeral.
Ubaydallah was contemporary and related to several Abbasid caliphs, princes and princesses. He had total ten half-siblings and he had one full brother named Ali ibn Muhammad al-Mahdi.