Yahya ibn Muhammad (Arabic: يحيى بن محمد) was the fifth Idrisid ruler and sultan of Morocco.
A son of previous sultan Muhammad ibn Idris, he took over the rule in Morocco after the death of his heirless uncle Ali I in 848. During his rule, which saw no significant conflicts, he settled in Fes numerous immigrants from Al-Andalus and Ifriqiya, which had been expelled after revolting against the Umayyad and Aghlabids respectively. He also commissioned several relevant construction in the city, the mosque of Al-Karaouine and of al-Andalus (859).
He died in 864, aged around 35. He was succeeded by his son Yahya II ibn Yahya.