House Minority Leader Robert. H. Michel (R-Ill.), the congressional captain of the Reagan economic program, declared victory early this morning and said he would return to Washington seeking to "heal the wounds" evident in the closest race of his political career.

Michel was leading Democratic opponent G. Douglas Stephens by only 6,000 votes with 95 percent of the ballots counted when he appeared at a hotel in downtown Peoria to say he had won a race that had become a nationally symbolic test of Reaganomics.

"I guess the narrowness of the victory was a product of the times," said Michel, who had carried his district in central Illinois by 62 percent of the vote only two years ago. "I have ears, and I've heard what the people have said. There's frustration out here, there's high unemployment here. We may have to adjust to some degree the direction we've been going, but I think we're still on the right track."

Exit polls conducted by ABC throughout the day Tuesday indicated that Stephens and other Democratic candidates in Illinois were riding a wave of voter discontent over joblessness and fears that the Republicans plan to alter the Social Security system.

Seven out of 10 voters interviewed in Michel's 18th Congressional District and other parts of Illinois said they disapproved of Reagan's handling of the unemployment problem. Another 73 percent said they feared Reagan and the Republicans would cut back on Social Security benefits. About 68 percent of the voters in the district went to the polls Tuesday, a record number for an off-year election there.

Michel, 59, relied on his prestigious position in Washington, 26 years of experience in Congress, a folksy midwestern personality, the conservative traditions of his district and a half-million-dollar media campaign to survive the toughest challenge of his career.

His opponent, the 31-year-old son of a local Teamsters official, spent about one-fifth as much money. His campaign was fueled by the uncommonly unified support of the local labor unions -- an estimated 40 percent of whose members voted for Reagan and Michel in 1980 -- and by an army of field workers sent to the district by the Democratic Congressional Campaign Committee.

Tuesday morning at Stephens' headquarters and four union halls, the first shift of 250 Election Day workers gathered for a massive get-out-the-vote effort organized by an expert from presidential aspirant Walter F. Mondale's political action group. It was the largest, best organized effort by the Democrats in anyone's memory. The final effort, if run perfectly, was expected to bring out an extra 2 or 3 percent for the Stephens vote.

Despite Michel's longstanding popularity -- he won with 59 percent or more of the votes in 10 of his 13 previous elections -- the Democratic-labor coalition sensed that he might be vulnerable this year because of the hard times that have hit central Illinois.

The region's largest employer, Caterpillar Tractor Co., which had thrived during several previous recessions, suffered this year as never before. It laid off 8,000 workers, lost a major contract when Reagan imposed an embargo on pipe laying equipment to the Soviet Union, and is being struck by the United Auto Workers.

Scores of those employes kept busy this fall working to defeat Michel, whose support of Reagan in Washington and whose anti-labor statements here served as a magnet for their frustrations. The labor halls in Peoria, East Peoria, Morton and Pekin were transformed into unofficial Stephens headquarters, with telephone banks working in the back rooms day and night. Their canvassing showed 78 percent of the labor vote going Democratic this year.

Stephens, whose father was a big man in blue-collar Peoria, took on the aura of a folk hero when he appeared at labor rallies this fall, receiving thunderous ovations at every stop.

"The kid really caught something," said Bill Prather, Peoria County Democratic chairman. "He generated more excitement among the working people here than I've ever seen."

As a write-in candidate who won the Democratic primary with only 1,936 votes, Stephens at first was not regarded seriously by Michel, who referred to him as some "yokel-dokel."

But an early poll by the Democrats, which showed Stephens within nine points of Michel, quickly changed the tenor of the campaign. A flock of journalists came to town, lured by the theme of the House minority leader running for his life in a region that has long been a metaphor of middle America.

By early October, when Michel returned home from Congress, the race had tightened up. Michel was forced to campaign, as he put it, "as though I were a gol' darn freshman." Reagan and former president Gerald R. Ford were brought in for pep rallies.

The Republican Congressional Campaign Committee sent money and a direct mail expert. The minority leader's staff was transplanted to the home office. And Michel used much of his money to run negative campaign ads--something he had never before felt compelled to do.

"I didn't want to do it, but our polls showed that 48 percent of the people who liked Stephens didn't know a thing about him," said Michel. "We thought we'd tell them a thing or two." He began portraying Stephens, a lawyer whose clients include the UAW, as a puppet of organized labor who would have no clout in Washington.

Still, Michel's chief asset during the final days of the campaign was not his money or his power on Capitol Hill but the considerable local connections and name recognition he has built up over a quarter-century of politicking.

Traveling through the small towns of Roanoke and Eureka on election eve, Michel was on a first-name basis with almost all of the furniture store owners, clothing salesmen, Rotarians, clerks, supervisors and sheriffs he encountered.

To them, his familiar and reassuring nature seemed more important than his position in the national debate over unemployment, inflation and Social Security.

There are 287,774 registered voters in the district, half of them in industrial Peoria and Tazewell counties and half of them in towns like Roanoke.

The Michel-Stephens campaign, despite the national hoopla and the serious ideological disputes between the two men, in the end came down to those two very different, but indigenous, ways of life in central Illinois.