Prime Minister Menachem Begin's fragile parliamentary coalition majority moved closer to collapse today as attempts to resolve a Cabinet impasse over the deteriorating economy failed, and Begin began sending out signals that he will resign if any ministers decide to defect this weekend.

Begin, who earlier in the week said that even if he lost a parliamentary vote of confidence he would remain in the premiership in a minority government, reportedly has told his closest aides that he will resign if either of two Cabinet members threatening to quit actually does so on Sunday.

By handing in his resignation, Begin may head off an opposition Labor Party move to dissolve the Knesset (parliament), sources close to the prime minister said. The opposition is preparing to introduce such a motion Tuesday.

Education Minister Zevulun Hammer and Finance Minister Yigael Hurvitz vowed to quit the government -- and take their coalition partners with them -- if they do not prevail in a Cabinet vote Sunday on a controversial proposal to increase teachers' salaries by 30 to 60 percent.

Hurvitz, who last year was promoted to deputy minister and directed by the Cabinet to salvage Israel's inflation-ridden economy by imposing stiff economic reforms, has said the teachers' wage increases would cause labor bargaining chaos throughout the country. Hammer has said rejection of the raises, which he promised the teachers, would trigger a nationwide school strike.

If the impasse is not resolved and Begin submits his resignation, President Yitzhak Navon would have to appoint a caretaker government -- probably the current Cabinet -- until elections are held.

Knesset sources said today that Begin apparently had recognized the inevitability of a Labor Party move to dissolve the Knesset and had decided to head off that process by resigning and freezing the current Cabinet in place -- at least for the transition period before elections.

Begin was elected, along with his rightist Likud coalition, in May 1977. His term is due to run out next November.

In a further setback to Begin's attempts to hold together his coalition, National Religious Party chairman Yehuda Ben-Meir said that his party, which holds 12 pivotal seats in the Knesset, will not agree to any postponement of national elections if one of the 22 Cabinet members resigns.

Ben-Meir's threat, in effect, was that if either Hammer or Hurvitz quits the Cabinet over the teacher salary impasse, his 12 Knesset members will leave the coalition and thereby doom the government.

Tonight, however, Interior Minister Yosef Burg, a National Religious Party member, and Hammer, a factional leader of the same party, met and said afterward that if only Hurvitz resigns, the party probably would not leave the coalition. They said that if Hammer has to resign, the party will withdraw from the coalition.

As it stands now, Begin's coalition has 61 of the Knesset's 120 seats.

Begin's support deteriorated further today when Energy Minister Yitzhak Modai, a member of the coalition-linked Liberal Party, told Israeli radio and television that the government has "outlived its usefulness," and that "only a miracle" could save it.

Modai said that for several weeks he had been convinced of the inevitability of the collapse of the Likud, and that he has decided if either Hammer or Hurvitz resigns, he will urge Begin to resign.

Meanwhile, an eleventh-hour attempt by Shlomo Lorincz, a member of the orthodox Agudat Israel (Union of Israel) party and chairman of the Knesset Finance Committee, to mediate a compromise between Hammer and Hurvitz apparently failed.

Lorincz proposed that a special study commission's recommendation on teacher wage increases be accepted in principle, but that actual implementation of the increases be postponed. However, in a meeting in Tel Aviv, the teachers' union rejected the compromise.

In another development, opposition Labor Party leader Shimon Peres said he will press next week for a Knesset law shortening the campaign for new elections to two months. He said that when the Begin government collapses, elections should be held as soon as possible to allow an orderly transition.