Defense Secretary Caspar W. Weinberger said yesterday that anti-American sentiment aroused by Greek Prime Minister Andreas Papandreou was partly responsible for a terrorist bombing that injured 57 Americans near Athens last Saturday.

"Certainly there's been an awful lot of totally unnecessary and very damaging anti-American feeling that has been stirred up," Weinberger told a budget hearing of the House Armed Services Committee.

Weinberger said it is unclear who planted the time bomb in a bar popular with U.S. servicemen and added: "It is one of the things you tend to get when this anti-American sentiment is stirred up."

"It is quite true that Mr. Papandreou has made very difficult and damaging comments about our country and about the relationship between the countries," he said.

Weinberger's criticism, in response to a question from Rep. Norman Sisisky (D-Va.), was the first by an administration official linking critical remarks by the socialist prime minister with the bombing.

An unknown group, calling itself the National Front, claimed responsibility for the attack and warned of further attacks "against the Americans who are responsible for the continued situation in Cyprus."

Weinberger visited Papandreou in Athens last April and called his meeting with the leader of a NATO ally productive and friendly.

Since then, however, the administration has become increasingly dismayed by Papandreou's criticism of the United States. He also has sought to reach agreements with his communist neighbors to the north -- Albania, Bulgaria and Yugoslavia -- without consulting NATO, has courted Libyan leader Col. Muammar Qaddafi and has charged that the South Korean passenger airliner shot down by Soviet missiles in 1983 was on a U.S. spy mission.

U.S. and Greek officials also have clashed over military matters, including treatment of U.S. servicemen at several bases in Greece. About 3,700 U.S. troops are stationed in Greece, which Weinberger yesterday called "one of the eastern anchors of NATO."

Weinberger said U.S. forces are inadequately housed there because Greece has set unacceptable conditions for improving the bases, including hiring of local contractors.

"That is a source of great distress," he said. "It is controlled by the Greek government, and they have refused to recognize the basic American rule that work we do with our funds should be under our basic direction . . . ."

Sisisky said he visited Greece recently, where he discovered poor living conditions for U.S. servicemen and concluded that "we're not wanted there."

"Do we have to take this?" he asked Weinberger. "You said it yourself. Why do we have to go where we're not wanted?"

Weinberger said the U.S. military presence is vital to bolster U.S. and NATO defenses in the Mediterranean region.

The bombing at a crowded bar near a U.S. airbase was the first reported terrorist attack on a facility frequented by U.S. servicemen in Greece.

Thirteen injured U.S. soldiers and dependents were airlifted to a U.S. base in West Germany for treatment. No one was reported killed.

Two Americans, including a serviceman, have been assassinated in Greece in the last 10 months.