Yitzhak Shamir, the fiercely right-wing speaker of Israel's parliament who refused to support the Camp David peace treaty, today was named foreign minister by Prime Minister Menachem Begin.

Shamir, 65, will fill the vacancy left by the resignation last October of Moshe Dayan in a dispute over what Dayan termed the Likud government's inflexible position in the negotiations on the future of the occupied West Bank and Gaza Strip. In contrast to Dayan's push for flexibility, Shamir opposed the Camp David treaty because it called for abandoning Jewish settlements in the Sinai Peninsula.

The Israeli Cabinet is expected to formally endorse Shamir Monday with parliamentary confirmation following. The position of foreign minister has been held by Begin since October on an acting basis.

Shamir, a commander of the terrorist Stern Gang in the 1940s and a rival of Begin in the Jewish struggle against British authority in Palestine, will bolster the hawkish wing of the Lukid Cabinet at a time when Israel's policies in the occupied territories are coming under increasing fire from the United Nations and the European Community.

Shamir, a self-described revisionist Zionist, is an outspoken advocate of Israel's biblical right to build civilian settlements in territory seized during the 1967 Six-Day War. When he abstained on the Knesset (parliament) vote ratifying the peace treaty last year, Shamir, a speaker offered a respectable cover for dissenters during the post-Camp espectable cover for dissenters during the post-Camp David peace euphoria that swept Israel.

It remained unclear tonight whether Begin intends to restore to the Foreign Ministry any of the power he stripped away over the past two years, which encouraged Dayan's resignation. Begin entrusted the crucial Palestinian autonomy negotiations to Interior Minister Yosef Burg and most matters dealing with southern Lebanon to Defense Minister Ezer Weizman, leaving the Foreign Ministry with little more than routine diplomatic chores.

As a result, Begin retained tighter control over foreign policy than when the maverick Dayan was in charge. But the ministry has slipped into noticeable disarray and morale has fallen among its career diplomats. That worsened when Begin reached outside the ministry by naming his chief political adviser, Eliahu Ben-Elissar, to be the first Israeli ambassador to Egypt.

In an interview, Shamir seemed to be sensitive to the malaise in the Likud government in the face of sagging popularity in opinion polls and the worsening economic situation in Israel, where inflation is running 111 percent annually.

"There are big differences for us, because we do not have any experience in government," Shamir said, referring to the Herut Party, which is the nucleus of the Likud. "Maybe we arrived at these positions too late. All of us, the leading group, are not young anymore. Maybe it would have been better if we had come in 10 years earlier. But we must do the best with it," he added.

Because the Labor Party had been in power since the founding of the state, Shamir observed, the ascension of Likud was "like a revolution -- you have to learn by trial and error.

"The test is to learn by mistakes. I hope we will have time for it," Shamir added noting that elections are barely two years away.

Shamir's political ideology, like Begin's, is rooted in the teachings of Zeev Jabotinsky, the revisionist leader founder of the Betar movement, which Shamir joined in his home in eastern Poland.

In 1935 Shamir emigrated to Palestine, where he studied at Hebrew University, worked as an accountant and joined the underground Irgun guerrilla group, later to be headed by Begin. However, in 1941, following a split in the Irgun, Shamir followed Avraham Stern to form Lehi, a rival group.

Twice arrested by the British, in 1941 and 1946, Shamir escaped twice, the last time from a prison in Eritrea. With a large reward on his head, he reached the French colony of Djibouti and was given political asylum in France before returning to Israel in 1948.

Shortly afterward, he found his Stern Gang in conflict with the new government when some of its members were charged with killing the U.N. mediator, Count Folke Bernadotte. The assassination led then-president David Ben-Gurion to declare the Stern Gang illegal. From 1955 to 1965, Shamir worked for Israel's intelligence service, the Mossad, traveling widely in the French-speaking world and reaching the top ranks of the spy network. In 1970, he joined Begin's Herut movement, working his way up to the party's executive and winning a knesset seat in 1973. He was elected speaker in June 1977.

A short, powerfully built man with large bushy eyebrows and a self-conscious smile that belies his stern gavel-pounding appearance during the often unruly Knesset debates, Shamir will bring to the Foreign Ministry a style that is certain to contrast sharply with Dayan's.

Because of his faltering English and the reticence he inherited from years in clandestine intelligence work, Shamir is viewed by some outside observers as a man with a narrow vision of the world and with few credentials for intricate diplomacy.

He is certain to be less public than Dayan, and already he is on record as urging Cabinet ministers to do less talking in public and more work in private.

Shamir is unmistakably a Begin loyalist, and if it is Begin's intention to direct Israel's foreign policy from the prime minister's office, it is unlikely that the new foreign minister will object as Dayan did. But Begin is also no doubt mindful of the independent streak Shamir displayed in his vote against the Camp David treaty.