DES MOINES, AUG. 8 -- Michael S. Dukakis and Richard A. Gephardt questioned each other's approach to trade and economic policy in the first two-man debate of the Democratic presidential contest here today, an event in which both may have gained at the expense of their five absent rivals.

Dukakis, the governor of Massachusetts, criticized the restrictive trade amendment sponsored by the Missouri congressman and Gephardt's past support for tax cuts and defense measures backed by the Reagan administration.

In turn, Gephardt sought to polish his image as a populist battler for farmers and workers and said Dukakis was "out of step with . . . the Democratic Party" and devoid of suggestions for helping those hurt by President Reagan's economic policies.

The debate had almost none of the caustic tone of the arms-length exchanges between the two Democrats in the past month and left both camps satisfied they had gained valuable exposure here and in New England, where it was carried on television.

The audience at a Drake University auditorium, which was composed largely of backers of the two candidates, obeyed the injunction of the moderator, law school dean David Walker, and listened in silence to the hour-long dialogue in which the candidates questioned each other.

Dukakis, in the view of neutral observers, managed to put Gephardt on the defensive over his votes for the 1981 Reagan tax cuts and various weapons systems -- sensitive issues for the liberal Democrats who usually dominate the Iowa precinct caucuses.

But Gephardt strategists took satisfaction from the fact that while the debate was largely ignored by Iowa television stations, every channel in Boston carried it on a live or delayed basis. They calculate it will help bring Gephardt "out of the pack" of Dukakis challengers in the major population areas of New Hampshire, which get Boston television. Dukakis aides said they figure the newspaper and broadcast news coverage here will be worth days of campaign time in a state where Gephardt had a two-year head start in campaigning.

Iowa and New Hampshire are the leadoff states in the Democratic delegate selection process next February.

The two-man debate -- a subject of envy to the rivals, Sens. Joseph R. Biden Jr. (Del.), Paul Simon (Ill.) and Albert Gore Jr. (Tenn.); former Arizona governor Bruce Babbitt and Jesse L. Jackson -- was provoked by acrimonious exchanges on the trade issue. Gephardt and Dukakis rehashed their differences on that question today. Gephardt said his trade amendment drew the support of 10 of 11 Massachusetts Democrats when it passed the House earlier this year, leaving Dukakis "out of step with where the Democratic Party is going." The measure, requiring tariff sanctions against countries like Japan that have a persistent trade surplus with the United States, would open foreign markets to U.S. goods, Gephardt said. He urged Dukakis to "stop listening to the editorial writers . . . and listen to the people who are getting crushed" by foreign imports.

But the governor said "the Gephardt amendment is dead" after being substantially modified in the Senate version of the trade bill and asserted that "the president has all the authority he needs today" if the next chief executive just applied "tough, smart, effective leadership" to trade negotiations.

Gephardt, denying that the Senate had rejected his approach, told Dukakis, "If you're not for a change in the law, you won't get any change" in restrictive practices by other nations. Dukakis said he favored granting U.S. industries up to five years of protection from foreign competition, but only if "those folks take steps to get competitive."

If both men succeeded in making the points they wanted on the trade issue, Dukakis appeared to score more often by raising collateral issues. Although he has expressed skepticism elsewhere, Gephardt today barely challenged Dukakis' boast that Massachusetts' 2.5 percent unemployment rate constituted "an economic miracle."

The governor went hard at Gephardt for backing the 1981 Reagan tax cut, saying the resulting budget deficits "virtually destroyed our position in world trade." He raised Gephardt's support of the Carter administration's 1979 grain embargo to the Soviet Union, which Gephardt conceded was "a mistake."

Dukakis said that at various times Gephardt had voted for the neutron bomb, the MX missile and chemical weapons, and against cuts in the Strategic Defense Initiative. When Gephardt explained the circumstances of each vote, Dukakis said it amounted to a "start-and-stop defense policy."

Gephardt replied that "on any issue, I'd rather change and be right than be rigid and wrong." He reminded Dukakis that the governor had run the first time on a pledge of no tax hikes "and then found you had to do it, and I admire you for it."

Gephardt argued the case for an oil-import fee, saying it would help the United States achieve energy independence and bring prices to the level that alternative fuels, such as gasohol, would be economic.

But Dukakis, claiming such a tax would raise expenses $50 billion and cost the country 500,000 jobs, said "it isn't good policy, long or short term."

Throughout, Dukakis tried to portray himself as an executive who found solutions to problems while Gephardt was simply a legislator who drafted laws. But at a post-debate news conference, Gephardt complained, "I know now what Michael Dukakis is against, but I don't know what he's for."