NASHUA, N.H., AUG. 27 -- Reps. Jack Kemp (R-N.Y.) and Richard A. Gephardt (D-Mo.) brought their presidential debate here today, and their sharply worded but good-natured exchange probably helped both of them reach their vastly different constituencies.

The old friends, trying to break the historical jinx against House members winning presidential nominations, clashed repeatedly on the Strategic Defense Initiative and aid to the Nicaraguan contras.

Kemp, aiming his arguments at conservatives in the GOP, accused Gephardt and his six Democratic rivals of being "neoisolationists" and said he would sign no new arms control treaty with the Soviet Union until all its past treaty violations were ended.

Gephardt, assailing the "rogue foreign policy" record of the Reagan administration in a fashion designed to ingratiate himself with Democratic liberals, told Kemp, "the only answer you have . . . is to wipe out anyone who doesn't agree with us." "I'm not a hawk," Kemp assured him. "I'm a dove -- a heavily armed dove . . . . Diplomacy without the use of force or the threat of force is emasculated."

Gephardt shot back, "A dove that's too heavily armed cannot fly." He said Kemp should remember that in the national emblem, the American eagle carries arrows in one claw and olive branches in the other. "You've dropped all the olive branches," he told Kemp.

Kemp drew more applause than Gephardt from the small audience at Rivier College, and Gephardt said afterward that his friendly rival appeared "better prepared" than when they debated trade policy last month in Iowa. Even Kemp's managers conceded Gephardt had won the first encounter, but Kemp studied tapes of that debate and prepared intensively for the return bout, in which he at least held his own.

With Gephardt in full cry against President Reagan's foreign policy, Kemp muted his past criticisms of the administration. The New York congressman, who has called for the resignation of Secretary of State George P. Shultz and criticized Reagan's support of recent peace moves in Nicaragua, celebrated the fact that "not one inch of territory has been lost by the free world" since Reagan became president.

Gephardt, by contrast, said the administration had broken the law in sending arms to Iran, had conducted a "blunder-in and bug-out" policy in Lebanon, and now had exposed American lives to risks in the Persian Gulf. He called the naval forces patrolling the gulf "a floating Beirut, just waiting to happen."

Kemp said that Gephardt and others in the "liberal wing of the Democratic Party . . . won't pay the price" for defending freedom anywhere in the world. That "neoisolationist" policy, he said, "is as dangerous in the '80s as it was in the '30s."

Their sharpest differences came on the contras and SDI, the president's missile-defense plan. Kemp, who is supporting an immediate $310 million appropriation to the forces opposing the Sandinista government in Nicaragua, said the Managua regime "is a hard-core Marxist-Leninist" outfit, which has opened the country to Soviet and other hostile forces. "For God's sake, Dick," he exclaimed, "what is the PLO {Palestine Liberation Organization} doing in Nicaragua?"

Gephardt replied that one reason might be that "we have been sending millions to the contras." He promised to end such aid the day he becomes president, if it has not been cut off before.

Kemp said the next president has "the obligation to defend the American people against the threat" of a nuclear attack by deploying an antimissile umbrella such as the one envisioned in SDI. The question, he said, "is should we defend lives or avenge lives?"

Gephardt said that a full-scale antimissile system is "probably not doable or affordable. There is no technological fix for a human problem. The only way to prevent a nuclear attack is to assure it never happens."

Kemp accused Gephardt of inconsistency, saying the Democrat had criticized Reagan's 1981 tax cut but voted for it, and had told Iowa peace groups he opposed the MX missile, though he voted for it early in the Reagan years. "Ladies and gentlemen," Kemp said, "I wouldn't be surprised to find out he voted for Ronald Reagan."

Gephardt assured him he had not, and then, referring to Kemp's recent criticisms of the Reagan administration, added, "I don't think you'd vote for him again."

Kemp told a news conference after the debate that he enjoyed the two bouts with Gephardt so much he would next like to debate Massachusetts Gov. Michael S. Dukakis.