Al-Mahdi, who was 84, died in the United Arab Emirates, where he had traveled for treatment after contracting the virus, his family said in a statement.
He led Sudan as prime minister twice, first in the 1960s and again from 1986 until the 1989 coup.
As the head of the opposition National Umma Party, Al-Mahdi became one of Bashir’s fiercest critics and lived long enough to witness Bashir’s overthrow by the army last year amid mass protests.
Descended from the 19th century religious leader “The Mahdi of Khartoum” who fought British and Ottoman rule, Al-Mahdi also led the Ansar Sufi order, one of the largest religious groupings in Sudan.
The US Embassy in Khartoum offered its “deepest condolences to the people of Sudan” and to the “family and friends” of Al-Mahdi in a tweet on Thursday.
As recently as October, Al-Mahdi criticized US President Donald Trump and his announcement that Sudan and Israel had agreed to normalize relations.
Sudan has so far reported 16,649 cases of coronavirus and 1,210 deaths, according to Johns Hopkins University.