Demonstrating growing concern over the possibility of war, a majority of Americans say they want Congress to limit the continued deployment of U.S. Marines in Lebanon to six months or less, according to a Washington Post-ABC News poll.

Only 29 percent of those questioned nationwide last weekend were willing for President Reagan to keep the Marines in Lebanon for another 18 months, as authorized in the compromise resolution approved by the House yesterday, while 58 percent said the Marines should be brought home in six months or sooner.

Forty-three percent said they think the United States will become so involved in the conflict in Lebanon that this country will go to war there, but 46 percent say they think the United States will stay out of war.

The poll showed that overall anxiety about the possibility of war has increased dramatically in the weeks since four Marines were killed in Lebanon and since a Soviet pilot shot down a South Korean airliner, killing 269 people.

One in four Americans listed the threat of war as the nation's No. 1 problem. A total of 34 percent saw war, the Soviet Union, communism and international affairs generally as the nation's worst problem.

That is more than three times the magnitude of such concern since The Washington Post-ABC News survey began in February, 1981. It places fear of war on a level with economic problems as the greatest concern of the American public. Six of every 10 Americans cited the Middle East as the worst trouble spot in the world, the one most likely to drag the United States into war with the Soviet Union. By comparison, only 1 in 10 cited Central America or Europe as posing a similar threat.

Asked whether they feel that what happens in Lebanon is important enough to risk going to war, 21 percent said yes, while far fewer expressed a willingness to risk war in Central America. However, 67 percent said Lebanon is not important enough to risk war.

The poll showed Americans sharply divided over what role U.S. forces should play in Lebanon.

Thirty percent said U.S. warships and planes off the coast of Lebanon should be used to help the Lebanese government fight those trying to overthrow it, including Syria and the Palestine Liberation Organization. Thirty-six percent said the ships and planes should be used only to defend the U.S. Marines in the multinational force in Lebanon. And 31 percent rejected both those alternatives, saying that all American forces should be withdrawn from Lebanon.

The poll was conducted last Thursday through Monday, before and after a cease-fire was agreed on by the opposing forces in Lebanon over the weekend. Those interviewed after the cease-fire was announced showed hardly any change in views from those interviewed earlier.

The public's heightened concern is reflected in other poll findings as well. Reagan continued to be viewed negatively for his handling of foreign affairs overall, and, for the first time, he was rated negatively for his dealings with the Soviet Union.

Forty-nine percent of those polled said they disapprove Reagan's handling of relations with the Soviet Union, 44 percent said they approve, and 7 percent expressed no opinion. Forty-nine percent also said Reagan's manner of dealing with the Soviet Union is increasing the chances of war. Only 34 percent expressed that sentiment as recently as August.

Until now, Post-ABC polls have shown that a plurality or majority believed Reagan's way of dealing with the Soviet Union decreased chances of war or, at the least, made no difference. In the new poll, however, only 33 percent said they believed this.

Ironically, one result of the shifting mood is increased support for Reagan's emphasis on bulding up the military. In three earlier surveys this year, a majority said Reagan was "going too far" in his plans to increase military spending. Less than a majority said they feel that way now.

Fifty-one percent also said they now support development of the MX missile, a change from earlier this year, and more people said the United States "should spend whatever is necessary to achieve military superiority over the Soviet Union."

Most people still said they want spending kept to a level producing equality in strength between the superpowers. But 32 percent said the United States should spend enough to achieve superiority, compared with 22 percent in August.

Reagan also scored much higher in responses to the question: "Who do you think has better goals for increasing military spending: Reagan or the Democratic leaders in Congress?"

At the end of July and the beginning of August, when the Post and ABC News first asked that question, the response was: 45 percent for Reagan and 40 percent for Democratic leaders, with 15 percent unable to choose. In the new survey, 50 percent favored Reagan's goals, 35 percent favored the Democrats, and 15 percent offered no opinion. According to the poll, Americans are sharply critical of Reagan's conduct of foreign affairs but they appear to be drifting toward his policies, rather than toward those of his leading opponents.

At the same time, there is virtually no change on one key issue: overwhelming public support for a freeze on nuclear weapons by both the United States and the Soviet Union. If anything, support for a freeze may be stronger than it has been.

When first asked if they approved of the freeze, 80 percent said yes. The Post-ABC News interviewers then listed arguments for and against the freeze to encourage more measured responses and asked once more whether people approved or disapproved of the freeze. In that second response, 77 percent said they approve.

Using the same procedure in April, 1982, the Post and ABC News found 76 percent supporting the freeze in response to the initial question about it, and 71 percent approving it after hearing the arguments on both sides.

The increase in those citing the possibility of war as the nation's No. 1 problem did not appear to be accompanied by a lessening of concern about the nation's economy. Instead, the poll indicated that optimism about the direction of the economy has leveled off.

Only 44 percent said they thought the economy is improving, compared with 50 percent who felt that way at the beginning of August. Only 15 percent thought the recession has ended. And Reagan is given slightly lower marks now than he was in August for his handling of the economy.