The four leading Democratic presidential candidates today attempted to capture the peace issue, but they refused to rule out the use of nuclear weapons if elected president.

Two hopefuls, Sens. Gary Hart (Colo.) and John Glenn (Ohio), told a forum on peace issues here that they would refrain from a full-scale retaliation if told that one or two Soviet missiles were heading toward this country.

In a long and sobering debate here each of the four candidates warmly embraced nuclear arms control and roundly condemned President Reagan's Central American and arms-control policies.

Glenn said he would never order a "first-strike" nuclear attack and would not "respond with hundreds of weapons" to a "single shot that hits out West, a demonstration shot in the mountains someplace."

He drew a gasp from the audience, however, when he said, "It would be inconceivable that a U.S. president wouldn't reply in kind" to a massive nuclear attack.

In response to another question about a hypothetical nuclear attack, Hart said he would refuse to order a counterattack if he were told as president that two Soviet missiles were headed for this country.

"No president could start a retaliation leading to World War III without better verification than that," Hart said, adding that "accidents or miscalculations" pose the greatest threat of nuclear war.

Two other candidates, former vice president Walter F. Mondale and Sen. Alan Cranston (D-Calif.), were slightly more circumspect.

"I wouldn't be trigger-happy," Cranston said.

"Everything conceivably possible must be done within reason by the president to seek out and restrain the final madness," Mondale said.

The comments came during the longest and most detailed debate of the race for the 1984 Democratic presidential nomination, held in the state that will host the first presidential caucuses of 1984. The debate was sponsored by a group called People Encouraging Arms Control Efforts (PEACE).

Each candidate present at the forum lashed out at Reagan's handling of the Central American issue.

"This administration does not know what it's doing in Central America," Mondale said. "They have widened the dispute, they have militarized it."

Hart, whose campaign has been struggling here as elsewhere, picked up a similar refrain, stating, "This president has no appreciation for history or the image of America in the hemisphere."

Although Cranston and Hart received the warmest applause from the audience, few clear differences emerged among the candidates. Each of the four endorsed the proposed nuclear freeze and pledged, if elected, to commit major efforts to securing a major nuclear arms-control agreement with the Soviets.

Cranston, who has based much of his campaign on arms-control issues, declared that if elected he would halt all testing of nuclear weapons as long as the Soviet Union did not conduct any tests. On a questionnaire filled out before the debate, Mondale, Hart and Sen. Ernest F. Hollings (D-S.C.) also said they would support such a move.

Glenn received the only negative reaction of the afternoon: scattered hisses when he tried to explain his Senate vote last month for construction of nerve gas weapons. He argued that the new weapons would be safer than ones now stored in U.S. arsenals. The other candidates disagreed with Glenn on this issue.

More than 1,800 persons attended the forum.

There were candidates' buttons and a few protest signs ("El Salvador Is Spanish for Vietnam," one said) scattered through the audience. Rep. Berkley W. Bedell (D-Iowa), who conceived the idea of the conference, made it clear to the candidates what the audience was seeking.

"Quite frankly, gentlemen, you want votes, we want commitments," he told them. "We want commitments on reducing world tensions, curbing the arms race and redirecting our national priorities. We want a nuclear freeze."

The two southern dark horses, Hollings and former Florida governor Reubin Askew, missed the event. Askew was at a parade in Hanover, N.H., and sent a telegram of apology, signing it, "Sincerely, Rube."

Hollings canceled plans to attend early today after learning of the death of his 10-week-old granddaughter of apparent sudden infant death syndrome in Charleston, S.C. A speech he had prepared for delivery accused Reagan of "negligence and failure in office to address the need for peace and arms control."

The Democrats were in general philosophical agreement about nuclear arms control. Cranston told a press conference that the "main difference" among them was that "I'm stressing the need for a president who will cope with the arms race far more than any other candidate" and "no one else is committed to making it an absolute priority.

"The other difference is I've been working on this issue since 1945," he said. "I have a longer background and greater understanding of the issue."

Hart responded sharply, "I don't think anyone in this race has a corner on the concern about nuclear weapons. I put my nine-year record up against anyone."

Hart, vying with Cranston for the third-place spot in the Democratic field, agreed with him on another matter, however. Told that Cranston was leaving on a trip to Central America Wednesday, Hart said he was thinking of going there, too.

Later in the day, a statewide peace group called Stop The Arms Race endorsed Cranston's candidacy.