Ten minutes before their bus arrived at the Managua Convention Center to meet Sandinista President Daniel Ortega Aug. 31, Senate Minority Leader Robert J. Dole and four Republican colleagues were handed a piece of news that sounded like a trap snapping shut.

A U.S. Embassy official told them that Ortega insisted on Rep. Peter H. Kostmayer's sitting in. Freshman Sen. John S. McCain III of Arizona, remembering from his House days the Pennsylvania Democrat's pro-Sandinista enthusiasm, protested. It was no use, said the American diplomat. For Ortega, no Kostmayer, no meeting. Dole agreed.

Predictably, Kostmayer undercut U.S. unity by telling Nicaragua's Marxist-Leninist ruler that he need do ''much less than you could imagine to stop contra aid.'' What's more, he rationalized the Sandinista regime's repression by comparing it with U.S. limitations on civil liberties during wartime.

The Republican senators were trapped, debating Ortega on his terms. But the deeper trap, snaring Ronald Reagan and his Central American policy, was unwittingly exposed by Kostmayer. Six years of blood and travail by the contras are going down the drain in return for the ''peace plan's'' vague cosmetic gestures that surely will not bring democracy to Nicaragua.

Not until the Dole delegation arrived in Managua did it know it would see Ortega. When it reached the former country club to meet him, the astonished senators found the Managua press corps as listeners, plus Kostmayer seated next to where Dole and Ortega would be placed. After a little acrimony, Sen. Steve Symms of Idaho got the Democratic congressman to make room for the senators.

Ortega began with sarcasm: ''And how are the contras doing after receiving President Reagan's radio message?'' Symms reported that ''they're all very good, very good.'' McCain told Ortega: ''Enrique Bermudez {contra military leader} sends his very best regards.''

That triggered Ortega rhetoric for the assembled news media: ''I send a message to President Reagan and to Col. Bermudez to stop killing the children, to stop violating the human rights of the people of Nicaragua.'' In subsequent sparring, the senators confronted the Sandinista stone wall encountered for years by U.S. diplomats.

Dole suggested a ''three-way dialogue'' about a cease-fire among the United States, Sandinistas and contras. Since ''the head of the contras is the U.S. government,'' Ortega insisted, the United States and Nicaragua should negotiate. ''Maybe,'' McCain responded, ''we should negotiate with Cuba since they are your bosses.'' Ortega rejoined: ''Why don't you go from here to Havana?'' When Dole asked whether the Sandinistas would reopen the banned newspaper La Prensa, Ortega asked: ''Are you going to respect international law.''

Amid this acrimony, Peter Kostmayer intervened. A fifth-term House member, he is among those House Democrats led by chief deputy whip David Bonior of Michigan who consistently support the Sandinistas and endorse all claims of atrocities against the contras.

Kostmayer expressed hope that ''there will be no more contra aid,'' adding: ''You have to do much less than you could imagine to stop contra aid.'' Only ''relatively small steps in the right direction'' are needed. Dole raised his thumb, saying ''more.'' When Ortega asked for the ''small steps,'' Kostmayer specified opening La Prensa and a Catholic radio station and releasing from jail a recently arrested human-rights advocate.

Then, as if he had asked for too much, Kostmayer added: ''I recognize that your country has been under tremendous strain because of the war . . . . We have had a curtailment of civil liberties . . . during wartime in our own country. So, we understand that, and I think we agree. . . . {If} you take those steps, the Congress won't approve any more aid to finance the contras.''

There is the trap into which President Reagan has led the contras. To arrange a cease-fire, Ortega told the senators, ''The president of the United States immediately cuts off aid to the contras.'' Ortega then reopens a newspaper and radio station and frees a few political prisoners. That finishes the contras. Asked by Sen. Thad Cochran of Mississippi whether this would end Soviet aid, Ortega replied with unaccustomed candor: ''not necessarily.''

In Managua, Dole and his colleagues were greeted by smiles, V-for-victory signs and thumbs-up signals from people in the streets. They were told by Nicaraguans that in a fair election, the Sandinistas would get no more than 15 to 20 percent of the vote. But the contras and the pressure they impose on the Managua dictatorship, not to mention Ronald Reagan and Bob Dole, seem caught by Daniel Ortega's trap.