President Reagan's victory in the House Wednesday on the question of aid to the Nicaraguan rebels was built on a foundation of careful compromise, personal persuasion and old-fashioned horse-trading, and was aided by the weariness of lawmakers who have grown tired of dealing with the divisive issue.

The administration-backed aid package that the House approved, sponsored by Reps. Mickey Edwards (R-Okla.) and Ike Skelton (D-Mo.), contained enough concessions from Reagan's original proposal to attract a number of wavering votes.

The president weighed in with a heavy personal lobbying campaign not only to gain the extra votes but to hold on to those of other members who threatened to bolt from past support of administration policy. Whatever promises Reagan made were not known, but there was no doubt among combatants on both sides that he used the full powers of his office to gain the critical foreign policy victory.

There was also what Minority Whip Thomas S. Foley (D-Wash.) described yesterday as "a certain fatigue on the issue" in the House that clearly contributed to rejection of the Democratic alternative aid package sponsored by Rep. Dave McCurdy (Okla.).

By the time of the climactic vote Wednesday night, compromises on both sides had produced several similarities in the competing Edwards and McCurdy plans.

Both contained economic development funds for Nicaragua's democratic neighbors. Both provided $30 million in nonlethal "humanitarian" assistance to the counterrevolutionaries, or contras, fighting Nicaragua's Sandinista government. Both called for a strict accounting of how the funds were expended, and for creation of a bipartisan commission to monitor developments in Central America.

But there was one critical difference in the plans, on which the whole battle turned: the Edwards package guaranteed delivery of $70 million in military aid to the contras over the next 18 months, while McCurdy's proposal required another vote by Congress on the issue in the fall.

The House -- or at least several of the critical swing members who had been pulled in both directions for three months -- did not want to vote again.

"The second vote in October was probably what killed it," McCurdy said yesterday, agreeing with the assessment of Foley and others.

"People don't want to vote on this in October, before the election. They want to get it behind them. They're tired of jumping through the hoop."

The concessions that finally produced the Edwards aid plan were rooted in a trip to Central America earlier this month by McCurdy and several other lawmakers who opposed the original administration proposal in March, according to a Republican source who asked not to be identified.

The group returned convinced that administration policy had to be broadened to include economic assistance to Nicaragua's beleaguered democratic neighbors. Several were also persuaded that the United States must continue its pressure on the Sandinistas.

The trip was followed by about a dozen meetings involving McCurdy, House Minority Leader Robert H. Michel (R-Ill.) and other lawmakers from both parties in an attempt to agree on a package.

Consensus eluded the group on the key issue of a second vote on military aid, but enough new elements were added to the Edwards plan that three lawmakers who accompanied McCurdy to Central America -- Albert G. Bustamante (D-Tex.), Richard B. Ray (D-Ga.) and Olympia J. Snowe (R-Maine) -- switched sides.

McCurdy could not compromise on the question of the second vote without alienating his party's leadership. In the end, he stuck with the Democratic leaders.

Meanwhile, Reagan engaged in intensive lobbying, meeting with lawmakers and telephoning others in what one White House official called "the Vince Lombardi school of legislative strategy -- three yards at a time." Some of the effort was defensive, directed at members such as Reps. Wesley W. Watkins (D-Okla.) and Mark D. Siljander (R-Mich.) who had suggested a willingness to abandon the administration.

McCurdy yesterday declared a partial victory in the long struggle over contra aid.

"The bottom line is that they the administration made their plan very attractive for moderates," he said. "They came a long way."

As for House Democratic leaders, they suggested that the Reagan victory was almost inevitable under the circumstances and credited the president with waging an effective campaign of "retail politics" among individual members.

"When a president gets to the point that he can pinpoint 20 people and work face to face with them, he's hard to stop," House Speaker Thomas P. (Tip) O'Neill Jr. (D-Mass.) said. "One fellow said he had never spoken to a president and he was awed. How do you turn down a president?"

Reviewing the battle, the only note of resentment from O'Neill was directed at House Armed Services Committee Chairman Les Aspin (D-Wis.), who reversed his March vote to support Reagan this time.

"He's turning out just the way I thought," said O'Neill, who opposed Aspin's selection to head the panel. But otherwise O'Neill, who will retire at the end of this session, appeared sanguine, saying his spirits were lifted yesterday by news that his wife was feeling better and that the league-leading Boston Red Sox had won another baseball game.

"While we lost on contra aid , we did the right thing," O'Neill said. "We followed the will of the American people. You can't do more than that."

Staff writer David Hoffman contributed to this report.