Muhammad ibn Abi al-Shawarib

Abu'l-Hasan Muhammad ibn al-Hasan ibn Abdallah ibn Ali ibn Muhammad ibn Abd al-Malik ibn Abi'l-Shawarib (محمد بن الحسن بن أبي الشوارب) was a 10th-century Muslim jurist who served as chief qadi of Baghdad.

Born in 904/5, Muhammad belonged to the Banu Abi'l-Shawarib family of the Banu Umayyad clan, a Hanafi legal family that in the 9th and 11th centuries produced 24 qadis, including eight chief qadis, for the Abbasid caliphs. Muhammad was named chief qadi of the City of al-Mansur and of Sharqiya (West Baghdad, where the caliphal palaces were located) by caliph al-Mustakfi in September 944, shortly after his accession. At the same time, his brother Abdallah ibn Abi al-Shawarib served as qadi of East Baghdad. Muhammad was deposed and arrested on 16 September 945, as part of the caliph's purge of corrupt judges.

When al-Muti became caliph in January 946, he was recalled to office, as qadi of Sharqiya, the Two Holy Cities (Mecca and Medina), Yemen, Egypt, part of Syria, and the Iraqi provinces of Saqi al-Furat, Wasit and Samarra. He was dismissed again in January/February 947, and died in November/December 958.

His brother Abdallah served as chief qadi in 961–963.