Rep. John B. Anderson (R-Ill.), stretching his presidential campaign trail to the Middle East and Europe, caressed the Israeli government and people today with electoral pledges aimed at U.S. voters and underlining his long record of support for Israel.

Anderson made Jerusalem the first stop on what is in effect a transatlantic campaign swing scheduled to include talks -- and, his aides hope, extensive press coverage of them -- with political leaders in Israel, Egypt, France, West Germany and Britain.

The consultations are depicted officially as fact-finding. But Anderson's aides here readily acknowledge that they are designed primarily to attract attention for the independent candidate as his fellow Republicans prepare to meet next week in Detroit to nominate Ronald Reagan as their presidential candidate.

Anderson hopes to portray himself before the home electorate as a politician with first-hand foreign policy experience.

Israeli government officials seemed aware, however, that giving too warm an embrace to Anderson could be poorly received in the White House.

The reception being accorded him, an official said, is a compromise between the desire to be polite and the need to avoid offending the Carter administration by appearing too friendly to a rival.

Anderson was met by Moshe Meron, deputy speaker of the Israeli parliament, to emphasize his status as a legislator rather than his candidacy. Soon after his arrival, Anderson met with Deputy Prime Minister Yigael Yadin, former foreign minister Moshe Dayan and parliament speaker Vitzhak Berman.

An Anderson spokesman said it appeared unlikely the candidate would meet with Prime Minister Menachem Begin, who is convalescing from a heart attack.

Potential American political candidates regularly have traveled to Israel and other newsmaking countries seeking to establish themselves as experienced foreign policy hands. Israeli officials regarded Anderson's visit here in the middle of the political campaign as something of a novelty, however, using modern international communications to keep himself before the voting public back home at a time when rivals might overshadow him if he stayed on his own ground.

His aides pointed out, for example, that NBC-TV plans to interview Anderson during the Republican convention only hours after he is scheduled to see Prime Minister Margaret Thatcher of Britain. This was seen as a good opportunity to appear serious and well informed in contrast to the show-business atmosphere likely to surround Reagan at a political convention whose outcome is regarded as certain.

The four-day stop in Jerusalem is the longest and probably the most important on the tour, Anderson's aides said. This is because of what they view as the candidate's strong appeal to Jewish voters in the United States and his hope of drawing support away from President Carter on the basis of a consistent pro-Israeli voting record in Congress and a series of pro-Israeli campaign stands.

Some problems of extending U.S. campaigning overseas showed up among Anderson's advance team in Jerusalem and the Secret Service agents who got here early to prepare for his arrival. Nearly all of them fell sick with the most notorious of travelers ailments, called politely in the Israeli press this morning "a virus."

Some also seemed to have an exaggerated idea of the Israeli public's interest in Anderson. Reviewing arrangements with an Israeli official, one advance man asked what provision had been made for crowd control. He was told that there probably would not be crowds big enough to require control.

On his arrival at Ben Gurion Airport today, Anderson reiterated his Middle East positions, opposing a Palestinian state and barring negotiations with the Palestine Liberation Organization until it renounces terrorism and recognizes Israel.

He also included his qualified support for transfer of the U.S. embassy from Tel Aviv to Jerusalem, a stand particularly pleasing to Israeli feeders, whose insistence on all of Jerusalem as the Israeli capital has been particularly troublesome recently in the Palestinian autonomy talks with Egypt.

"I would be in favor, as a final act of the peace process, of having our government recognize Jerusalem as the Israeli capital and move our embassy there," he declared.

Purposefully vague, the statement taken at face value means that Anderson backs U.S. recognition of Jerusalem as the Israeli capital once all other issues with Arab governments and the Palestinians are settled, presumably as part of a Jerusalem agreement with the Arabs that would be "the final act of the peace process."

That, Israelis quickly pointed out, appears nearly impossible now, so Anderson's pledge stands little chance of being tested. They seemed pleased nevertheless. Anderson's position comes much closer to their liking than that of the U.S. government, which holds that the final status of Jerusalem must be the result of peace negotiations since the eastern part of the holy city was seized from Jordan in the 1967 Arab-Israeli war.

For that reason, the United States has not recognized Israel's annexation of the eastern sector and the declaration of the entire city as the Israeli capital, where foreign embassies should be. The American Embassy, along with those of most other countries, remains in Tel Aviv.

Anderson's vocal support also received a particularly warm welcome here because some Israelis have expressed fear that Carter could bring increased pressure on Israel for concessions in the autonomy talks if he is reelected and no longer has to face the Jewish electorate.

Several ministers urged in last Sunday's weekly Cabinet meeting that the Israeli government give more attention to exploiting the U.S. campaign so as to extract increased support and commitments of aid from the Carter administration. In that political sources said was little more than an attempt to pacify them, the Cabinet reportedly named a committee of several ministers to study the problem.

One Israeli official said today that Israeli politicians take U.S. campaign promises with the same grain of salt that American voters do. The Israeli outlook toward pledges of support like Anderson's can best be summed up by the popular song of 20 years ago, the official added: "But Will You Still Love Me Tomorrow?"

In addition, Israel's political class seemed to view, Anderson's visit here in the light more of his own electoral needs in the United States than Israel's own problems. "It's all part of the campaign, isn't it?" asked one member of the parliament's foreign affairs committee.