Public approval of President Reagan's handling of the invasion of Grenada appears to have produced wide-ranging political benefits for him, according to a new Washington Post-ABC News opinion poll.

For the first time since April, Reagan has edged ahead of the two leading Democratic candidates in trial heats for the 1984 election, and his overall popularity rating is higher than at any time since September, 1981.

Opinion analysts said that this kind of "rallying around the president" often occurs during a crisis and that there is no way of knowing how long it will last.

On the negative side for Reagan, the poll also shows concern that he may be bringing the country closer to war and indicates some discontentment about his handling of the big federal budget deficit.

Nevertheless, the president's policies on such diverse issues as military spending, the national economy and foreign affairs in general--all of which had been regarded unfavorably in recent months--now receive support at levels nearly as high as at any time since he took office.

Reagan's support declined immediately after the Oct. 25 invasion of Grenada, as determined by a Washington Post-ABC News poll a day later, perhaps because of the terrorist bombing of U.S. Marines in Lebanon the previous Sunday. However, on Oct. 27 Reagan made an emotional televised defense of his policies in Grenada and Lebanon, which appeared to boost his support substantially, according to a second Post-ABC News poll the following day.

Since then, Reagan has made numerous public appearances in which he has expressed pride in the U.S. military performance in Grenada and stressed his view that it was a rescue mission for Americans there. As a result, the president appears to be stronger politically than he has been for some time.

In late September, a Post-ABC News poll showed Reagan trailing former vice president Walter F. Mondale by 48 percent to 46 percent and Sen. John Glenn (D-Ohio) by 52 percent to 42 percent among registered voters in trial heats for the presidency next year.

The new survey shows him ahead of Mondale by 50 to 44 percent and Glenn by 48 to 45 percent among registered voters. Reagan leads the newest declared Democratic candidate, Jesse L. Jackson, by 64 to 25 percent.

In all, 63 percent of the 1,505 people interviewed in the poll said they approve of Reagan's handling of the presidency and 31 percent said they disapprove. From November, 1981, until the invasion of Grenada, Reagan had been rated slightly negatively or only slightly positively on that measure of popularity.

The president's highest approval rating in a Post-ABC News survey, 73 percent, came in late March and April, 1981, shortly after he was wounded in an assassination attempt. His lowest rating, 42 percent, came in January of this year after a long economic recession.

While the thrust of the new poll is overwhelmingly favorable for Reagan, in some areas, such as the economy and foreign affairs, the increased backing for him seems at variance with other public perceptions.

Views on Reagan's handling of the economy, for example, are more positive than they have been in more than two years, with 56 percent saying they approve and 39 percent saying they disapprove. But Americans are no more optimistic about whether the economy itself is improving than they were a month or two ago.

On his handling of foreign affairs in general, Reagan has more support than at any time since October, 1981. But, by 57 to 30 percent, Americans also say that the way the president is handling foreign affairs is increasing rather than decreasing the chances for war.

Women especially say they fear that Reagan is bringing the United States closer to war, with more than six in 10 of them taking that view. But a majority of men also agree with it.

As in other recent opinion polls, citizens take sharply differing views of events in Grenada and Lebanon.

Seventy-one percent in the survey said they approve of the invasion of Grenada, with only 22 percent saying they disapprove. By contrast, only 35 percent feel the U.S. government has clear goals for the Marines in Lebanon, compared to 52 percent who say there are no clear goals.

Critics of Reagan have expressed concern that public support for the operation in the Caribbean may encourage him to intervene more strongly in Nicaragua, where the United States has been recruiting and supporting rebels fighting the leftist Sandinista government.

It shows 30 percent saying they approve of the United States "being involved in trying to overthrow the government in Nicaragua" and 48 percent disapproving, with 22 percent expressing no opinion. That is far from majority support, but it shows sharp movement since August, when a Post-ABC News poll found 20 percent approving, 62 percent disapproving, and 18 percent with no opinion.