Justice Minister Yitzhak Modai abruptly resigned under fire today after accusing Prime Minister Shimon Peres of mishandling the investigation into the Shin Bet security service's alleged cover-up of the slaying of two captured Arab terrorists in 1984.

Modai, one of the most outspoken members of the rightist Likud bloc in the coalition Cabinet, announced his resignation two hours before an emergency Cabinet meeting at which Peres had planned to fire him, a move that could have precipitated a collapse of the coalition and led to early parliamentary elections.

Modai said, however, that he intended to return to the Cabinet on Oct. 25 when Peres and Foreign Minister Yitzhak Shamir, the Likud leader, switch positions under the coalition rotation agreement that formed the "national unity" government 22 months ago. Likud sources said that Modai might return as finance minister.

Peres, who forced Modai to give up the Finance Ministry position earlier this year following a similar outburst of personal criticism, made no commitments today that would assure Modai's return to the Cabinet. Any Cabinet Shamir forms in October will be subject to parliamentary approval.

The latest of a series of coalition disputes began Saturday when Modai, speaking at a high school in Herzliya, attacked Peres' handling of the Shin Bet security service scandal, saying the prime minister "knows as much about the law as he knows about economics."

Modai also said he had a "score to settle" with the prime minister, a reference to his ouster from the Finance Ministry earlier this year after he publicly questioned Peres' competence in the field of economics.

While contentious public exchanges are common in Israeli politics, a Cabinet tradition of collective responsibility prohibits, in theory at least, a Cabinet minister from openly criticizing positions approved by a majority. That principle has been loosely interpreted by prime ministers of both parties as proscribing vituperative attacks against their management of major issues of state.

In April, when Modai challenged Peres' competence in economic management, the prime minister was said to have warned him that a repetition would result in his dismissal.

In that coalition crisis, Peres rescinded his decision to fire Modai and instead moved him to the Justice Ministry only when it became clear that the 10 Likud ministers and their coalition allies were prepared to bring down the government and force early elections in defense of Modai.

In contrast, there appeared to be no such support of Modai today when Peres said he planned to fire the justice minister. Several Likud leaders said that rather than abort the rotation three months before it is to take effect, they would prefer that Modai step down and then return to the Cabinet in October.

At a news conference today, Modai accused Labor Party ministers of using even more derogatory language against Shamir, even to the point of publicly accusing him of participating in the cover-up of the beating deaths of two handcuffed Arab prisoners following a hijacking incident in the Gaza Strip on April 24, 1984, when Shamir was prime minister.

Modai accused the Labor Party of trying to bring about a collapse of the coalition to avoid the October rotation.

Likud legislator Moshe Katsav said his party had to decide between backing Modai and watching the coalition crumble, or asking him to temporarily step aside in order to preserve the rotation.

"After two years of swallowing a lot of things, and letting the Labor Party benefit, we could swallow this and let the rotation take place," Katsav said.