The Israeli air raid on the Palestine Liberation Organization headquarters in Tunisia was a response to terrorism and therefore a legitimate defensive use of U.S.-provided weapons, a senior U.S. official said tonight.

But the official, who spoke with reporters on condition he not be identified, also appeared to warn Israel not to engage in violent actions against the PLO in neighboring Jordan. The official talked with the journalists following Secretary of State George P. Shultz's two weeks of consultations with various world leaders at the United Nations.

On Jordan, the official was responding to reports that Ariel Sharon, an Israeli cabinet minister, had warned Jordan's King Hussein against permitting a buildup of PLO "terrorists" inside his country. The official said:

"The fact is that King Hussein probably has as good or better a record of fighting terrorism as anybody. It's a very strong record. I have great faith that King Hussein will deal with any problem of terrorism in Jordan and doesn't need help from anybody."

Asked whether that position had been communicated to Israel, the official replied, "I think they are aware of our views."

The bombing of the PLO Tunis headquarters Tuesday was followed by apparently contradictory statements from President Reagan and other administration officials about whether the United States approved of the raid. On Wednesday the administration, reportedly on advice from Shultz and Defense Secretary Caspar W. Weinberger, backed away from the idea that it had given the raid an unqualified endorsement.

"There isn't any particular confusion," the senior official insisted. "The comments that were made were fundamentally consistent with each other."

He specifically addressed the question of whether Israel had violated American law by using U.S.-made F15 fighters in the raid. Under the terms of foreign aid legislation, American weapons are to be used only for purposes of legitimate self-defense.

"The first question is, here is an action using American arms. Was it defensive?" the senior official said. "I think it's very clear, whatever views one may have about whether it was right or wrong, that it clearly was something done in response to terrorism which Israeli intelligence had traced to the PLO. So it was defensive. That was the statement made in the White House."

The official noted that Shultz, in a speech here Thursday night, had expressed concern that the pattern of violence in the Middle East could threaten moves to bring Israel and Jordan into direct negotiations on a solution to the Arab-Israeli conflict.

He noted that Shultz said in the speech that terrorism should not be allowed to find sanctuary and he added that a heightened awareness of this by all nations could help greatly to stop terrorism.

"We have developed the idea as a world community that hijacking, certainly a form of terrorism, is not tolerable, so hijackers deserve no sanctuary. It's had a very good effect and it ought to be applied to other forms of terrorism."

Asked about the possible effects of the raid on the Mideast peace process, the official said:

"My concern is with violence more generally. The Israeli raid was a response to the terrorism in Israel. It's part of a pattern and that whole pattern is a threat to the peace process . . . . We are not going to let the violence succeed."