The Republican-controlled Senate approved $38 million in nonmilitary aid for antigovernment rebels in Nicaragua last night on a 55-to-42 vote.

Before approving this aid and allowing the Central Intelligence Agency to administer it, the Senate defeated several efforts to restrict the aid further and to contain U.S. military involvement in the region.

Aid to the rebels was approved as part of a State Department funding bill that is expected to win final passage today.

"There may be a time when we need to take the second step and send the arms themselves but, for now, this is the right action at the right time," said Sen. J. Bennett Johnston (D-La.), one of 11 sponsors.

A proposal to bar President Reagan from sending combat troops to Nicaragua without advance congressional approval was rejected by a 2-to-1 margin.

Another proposal to require congressional approval before more U.S. troops are deployed anywhere in Central America was turned down by a 5-to-1 margin.

The compromise aid plan, offered by Senate Foreign Relations Committee Chairman Richard G. Lugar (R-Ind.) and Sen. Sam Nunn (Ga.), ranking Democrat on the Armed Services Committee, would release for this year $14 million "frozen" in an earlier dispute and authorize another $24 million for next year.

Passage was a qualified victory for the Reagan administration, which originally sought funds for covert military operations to aid counterrevolutionary forces in Nicaragua but had to accept "humanitarian" assistance after Congress balked earlier this year at allowing the CIA to handle the covert operations.

A major test is expected Tuesday when the Democratic-controlled House, which rejected even nonmilitary aid to the contras in April, is to vote on various rebel-aid proposals.

More Senate amendments are expected today.

Two major issues are the definition of humanitarian aid and whether funds would be channeled through the CIA. Key House proposals specifically limit the aid to food, clothing, medicine and similar help.

But the Senate measure, which bars "materiel aid" other than "humanitarian" assistance, could allow military uniforms, helicopters and even radar, "if it is set up outside a refugee camp, for example, for the purpose of self-protection," Nunn said.

After the vote, he said that, while he favors a "broad interpretation" of humanitarian aid, it would probably be decided "in case-by-case discussions" in intelligence committees.

The Senate measure would allow the CIA to handle the funds, but some House measures would channel it through international relief groups.

In a succession of defeats for Democratic and liberal Republican critics of the contra aid program, the Senate yesterday decisively rejected almost every proposal to limit American assistance.

In the closest vote, a proposal from Sen. Edward M. Kennedy (D-Mass.) that urged the administration to resume talks with Nicaragua's lefist Sandinista government was rejected on a 48-to-48 tie.

By a vote of 64 to 31, the Senate rejected a second Kennedy proposal to ban the introduction of U.S. forces into Nicaragua for combat purposes unless Congress declares war or specifically authorizes the troop commitment.

The Senate then rejected, 81 to 15, a proposal from Sen. Gary Hart (D-Colo.) to ban any increase in U.S. military forces in the Central American region without advance congressional approval.

An earlier proposal from Sen. Christopher J. Dodd (D-Conn.), rejected 79 to 17, would have extended an expiring ban on use of funds for military or paramilitary aid to the contras and limited the assistance to costs of withdrawing CIA-trained rebels and relocating them.

The Dodd proposal also sought to limit the administration's freedom of action by stipulating that the United States could intervene in Central America only in specific circumstances -- if nuclear weapons had been introduced into the region, for example, or if foreign military bases had been established.

Acknowledging the Marxist orientation of some of the Sandinista leaders but saying the United States should focus more on its own interests than on the politics of Nicaragua, Dodd expressed exasperation with fellow Democrats who voiced shock when Nicaraguan President Daniel Ortega visited Moscow recently.

"Where did my colleagues think he would go -- Disney World?" Dodd asked.

In response, Lugar contended that there will be no peace in Nicaragua or stability in Central America unless the contra program is continued.

In another development, Reagan, traveling in the South, indirectly denied reports in The New York Times suggesting that administration officials are openly discussing the possibility of sending combat forces into Nicaragua.

"We remain committed to a peaceful solution. So does the democratic opposition in Nicaragua. . . . This is what our assistance is designed to do: give peace a chance and keep alive the goal of freedom in Nicaragua," Reagan said.

Defense Department spokesman Michael I. Burch was more direct, saying, "It's not our desire at all to invade Nicaragua."

He said the Times reports do not "reflect the thoughts, feelings or desires of either the secretary Caspar W. Weinberger or the Joint Chiefs."

Burch said Weinberger "sees no need for intervention in that area of the world. The root cause of the problems down there are primarily economic."

Staff writer Thomas B. Edsall, with Reagan, reported from Birmingham, Ala.:

Reagan continued his war of words against Nicaragua and congressional opponents of his policy toward that country, telling a Republican audience that aiding the antigovernment rebels is part of "the transcendent moral issue of our time."

"Some would like to ignore Nicaragua's connection to the international terrorist network -- the PLO, Libya, and the followers of the Ayatollah Khomeini, who now, thanks to the Sandinista communists, have a foothold in Central America, just two hours by air from our southern border," Reagan told an enthusiastic crowd.

Appearing in behalf of freshman Sen. Jeremiah Denton (R-Ala.), Reagan attacked unnamed "left-wing" Democratic leaders and said "when it comes to the communists in Nicaragua, some have adopted a hear-no-evil, see-no-evil, speak-no-evil attitude."

He also called for a renewed effort to enact a constitutional amendment permitting prayer in public schools.

"This week's Supreme Court decision [striking down an Alabama law permitting a moment of silence for prayer in public schools] shows we still have an uphill battle before us," Reagan said.

"So I hope I can count on the support of Alabama's entire congressional delegation for our prayer amendment, because it is time it was adopted."