Karami said he had hit a wall in trying to form a cabinet, whose main task would be to supervise the elections which the United States and United Nations say must go ahead on time.
"We have once again reached a dead end," Karami told reporters in Beirut on Wednesday. "That is why I have invited you today to present my resignation."
An official said President Emile Lahud accepted the resignation and would seek a new prime minister this week.
Political sources have said the elections could be pushed back by weeks or months by the delay in forming a government.
But Karami said there was still time for the poll to be held on time.
Lahud (L) accepted Karami's
Karami was reappointed days after his first resignation. He then failed to persuade the anti-Syrian opposition to join a cabinet with pro-Syrian loyalists.
Karami, who since then was trying to form a government from pro-Syrian figures, also said he would quit a grouping of pro-Damascus Lebanese politicians.
President Lahud, also an ally of Syria, must consult parliament to pick the new prime minister.
Parliament's four-year term ends on 31 May. The constitution requires polls be called at least a month before voting day.
If elections are not held in May, parliament, currently dominated by pro-Syrian legislators, can extend its term by several months to avoid a political vacuum.
The new cabinet must draft the electoral law and supervise the poll, but agreeing on a draft bill and passing it through parliament is expected to take several weeks.
Karami's outgoing government had proposed an electoral law based on smaller constituencies, but the veteran Sunni politician now says the new cabinet would draft a law dividing Lebanon into at least five large electoral districts.
"The delaying tactic is going strong. If they go on, we might revert to popular pressure. We might go back to the street to force them to get on with it"
Lebanese opposition accuse pro-Syrian officials of trying to delay the vote, in which the opposition is expected to benefit from popular sympathy over the February killing of former Prime Minister Rafiq al-Hariri.
A prominent opposition Christian politician said before Karami's resignation the opposition might call protests against what he said were deliberate moves to push back the elections.
"The delaying tactic is going strong," said parliamentarian Nasib Lahud. "If they go on, we might revert to popular pressure. We might go back to the street to force them to get on with it."