"The prime minister handed the government´s resignation to the president who accepted it," a statement said without giving a reason for the resignation.
President Abdel Fattah al-Sisi asked Mahlab to stay on as caretaker prime minister until a new government is formed, the statement added.
The announcement comes as Egypt is set to hold long-delayed legislative elections in phases from October 17 to December 2.
The elections had initially been scheduled for early 2014 but were delayed on legal grounds amid charges from rights groups of repressive measures during a crackdown on the opposition.
On Monday, the prime minister´s office announced that agriculture minister Salah Helal had been arrested after being told to step aside on the orders of Sisi in connection with an investigation into corruption.
Helal and his chief of staff were believed to have "requested and received" bribes from a businessman, through an intermediary, to legalise the purchase of a property bought from the state.
Mahlab´s 31-member government was sworn in March 2014 and tasked with organising a presidential election which Sisi, the previous army chief, won in May of that year.
Sisi´s election victory came almost a year after he deposed his predecessor Mohamed Morsi in July 2013.
The upcoming polls will come more than two years after Sisi toppled Morsi, whose now-banned Muslim Brotherhood swept the last general election in 2011.