Last Oct. 24, when Congress voted $3.5 million in nonlethal aid to sustain Nicaraguan rebels through November, House Speaker Jim Wright (D-Tex.) said he was "guardedly optimistic" that it would be the last U.S. aid spent on President Reagan's controversial policy of supporting the contras.

But two weeks ago, Wright and other leaders of the Democratic-controlled Congress found themselves reluctantly agreeing to provide another $8.1 million to keep the contras in business through February. They acted under pressure of Reagan's threat to veto all funding for the federal government's fiscal 1988 operations if the legislation did not contain money for the contras. A veto would have confronted Congress with an embarrassing shutdown of the government.

In agreeing to the short-term extension of contra funding, the two sides scheduled for early February a "showdown" vote on whether to continue Reagan's policy of supporting the contras' armed struggle against Nicaragua's Marxist-led Sandinista government.

While such showdown votes on contra aid have been cast before, they have never resolved this long-running and bitterly contested foreign policy dispute between the administration and Capitol Hill Democrats.

Many times, the Democrats, as Wright did on Oct. 24, have been ready to predict the imminent demise of contra aid, only to find the administration staging a last-minute rescue that has kept the program intact. That has happened so frequently that one senior administration official remarked semi-facetiously, "It must be proof that God is on our side."

The administration, impelled by Reagan's strongly held conviction that the contras are the only reliable bulwark against a Sandinista-sponsored campaign to spread communism through Central America, has approached each round in the contra aid fight with all the lobbying skills and hardball political pressure it can muster.

That has been true ever since the program, which began in 1982 as a covert operation, became too big to keep secret and evolved into a subject of debate in Congress. In fact, the administration never conceded defeat after the 1984 setback when Congress, angered and embarrassed by revelations of such Central Intelligence Agency activities as the mining of Nicaraguan harbors, imposed what became a two-year cutoff of military aid to the contras. {Related story on Page A26.}

Instead, as the Iran-contra hearings last summer made clear, administration officials enabled the contras to survive by using a network of allegedly private supporters as a cover for diverting funds to aid the rebels. At the same time, the administration waged an unceasing and ultimately successful battle to induce Congress to reverse its ban and reinstitute both military and logistical assistance to the contras.

The opponents, while acknowledging that much of the administration's success is the result of its refusal to take no for an answer, argue that at many critical points the administration has received invaluable help from a most unlikely source -- Nicaragua's Sandinista leaders, including President Daniel Ortega and his brother, Defense Minister Humberto Ortega. On several occasions when the fate of contra aid hung in the balance, they seemed determined to do things that ran contrary to their own interests.

The most recent example came during the just-concluded battle over the $8.1 million in stopgap contra aid. Wright's prediction in October that there would be no such aid was based on awareness of how the Iran-contra revelations had damaged the credibility of the administration's case for the contras. He also spoke as the foremost U.S. champion of the Central American peace plan, which has aroused great expectations in the region and caused its leaders to call on outside powers such as the United States to halt aid to insurgent forces while they seek to make the peace process work.

But Wright also was sufficiently aware of past Sandinista mistakes to add the qualification: "unless some drastic change were to occur in the situation." And an event roughly fitting that description entered the equation when the administration produced a Nicaraguan defector, Maj. Roger Miranda Bengoechea, a former senior military official.

In a series of skillfully timed interviews with the news media and a whirl around Capitol Hill for meetings with wavering Democrats, he asserted that the Sandinistas, despite their participation in the peace plan, were secretly engaged in a program to bolster their military strength with the help of the Soviet Union.

Congressional sources, looking at the situation in retrospect, generally agree that Reagan's veto threat was the main reason that Congress went along with the $8.1 million in contra aid. But they add that there also is no question that Miranda's allegations were a factor in convincing some swing-vote Democrats from southern and border states where there is pro-contra sentiment, of the administration's argument that the contras are a necessary "insurance policy" against Sandinista subversion of Central America.

The Miranda case was only the latest instance of the administration capitalizing on the mistakes and ideological stubbornness of the Managua government.

In 1985, just after Congress turned aside an administration request to lift the ban on military aid by furnishing the contras with $14 million to acquire arms, Daniel Ortega gave the Democrats what many considered a slap in the face by traveling to Moscow. Many members, put on the defensive and not wanting to be portrayed as communist dupes, soon afterward voted to give the contras $27 million in nonlethal aid.

Subsequent administration efforts to induce Congress to resume military aid were assisted in

October 1985 when the Sandinistas decreed a state of emergency, severely curtailing civil liberties in Nicaragua, just before Ortega traveled to New York to seek support for his government in the United Nations.

In the spring of 1986, the Sandinistas crossed the border into neighboring Honduras to raid a contra training camp. Such incidents had happened before, but this one came on the eve of a Senate vote on a new administration request for $100 million in military and logistical aid. Although evidence indicated that the raid was aimed solely at the contras, the administration portrayed it as an

"invasion" of Honduras, thereby paving the way for passage of the package that resumed military aid.

That $100 million appropriation ran out when fiscal 1987 ended Sept. 30, and the recent skirmishes over stopgap contra funding have been preliminary to a new full-scale aid request. The administration, which originally said it planned to ask for a $270 million assistance package to cover 18 months, has put off making an actual request until later this month. It is then that the anticipated showdown on the issue will begin.

According to the agreement worked out in the stopgap spending bill, the president must make a formal aid request Jan. 25-27, with the House voting on it Feb. 3 and the Senate Feb. 4. But whether it will be a showdown that determines the course of U.S. relations with the contras or another inconclusive contest that sets the stage for another round is unclear.

Both sides agree that at least part of the answer will become evident later this month after presidents of the five Central American countries in the peace process evaluate how well it is working. Again, administration policy-makers are counting on what they regard as Sandinista intransigence and bad faith to allow them to appeal successfully to those Democrats who have provided the margin of victory for contra aid in the past. As one State Department official put it:

"We didn't win past rounds by pulling rabbits out of a hat. Ultimately the only rabbit we have is our ability to convince enough Democrats that they shouldn't sell us out in Central America. We understand they have to have something to hang their position on, and if they want to use the actions of the Ortega brothers or the Soviet Union as an excuse, that's okay with us. That's the rabbit we want to keep pulling out of the hat."