For five years as leader of the Republican minority in the House, Robert H. Michel (Ill.), has been the quintessential good soldier, defending his president's program even when it hurt back home.

So these have been days of anguish for Michel, the ruddy-faced son of a French immigrant factory worker, a traditional Republican who puts fealty to party and president just under loyalty to family.

A week ago, Michel orchestrated the surprise vote that prevented President Reagan's No. 1 domestic priority -- tax overhaul legislation -- from going to the House floor for a vote. With all but 14 of the 182 House Republicans backing his effort, it was one of the worst humiliations of Reagan's tenure in the White House.

But Bob Michel took no pleasure in claiming victory.

The tax bill drafted by the Democratic-controlled House Ways and Means Committee with input from Reagan's Treasury Department, Michel said, would have hurt his Illinois congressional district and lacked the support of House Republicans.

Nevertheless, Michel said it caused him "great anguish" to cross "my president." Longtime friend Rep. Lynn M. Martin (R-Ill.), added: "It's driving him crazy."

Yesterday, Michel returned -- at least part way -- to the Reagan fold by working to allow the bill to come up for debate and a vote. But he still opposed the measure on its merits and voted against it.

Michel has disagreed before with the White House over strategy on such issues as the MX missile, aid to Nicaraguan rebels and where to cut the federal budget. But those were mostly private wrangles, worked out behind closed doors, and much less significant than the very public collision over the tax bill.

A well-respected legislative strategist, Michel in 1981 and 1982 helped forge the coalition between Republicans and conservative Democrats that got Reagan's budget cuts and economic program through the Democratic-controlled House.

That victory for Reagan, which sent shell-shocked Democrats scurrying for cover, did not serve Michel well personally.

In the 1982 elections, with the ill effects of Reaganomics apparently battering his Peoria district's farm regions and industrial economy, Michel was nearly defeated for reelection by a young lawyer making his first run for public office.

Michel has been looking over his shoulder ever since.

Democratic campaign officials recently passed out poll results, hotly disputed by Michel's aides, that show the minority leader to be vulnerable politically because of dissatisfaction over federal farm policy and trade. About two-thirds of those polled said they believe Michel has not used his minority leader post to help his district.

At times Michel has had some troubles in his House as well. A younger, more confrontational group of lawmakers elected in the last six years frequently has been impatient with his style of compromise in dealing with the Democrats.

The criticism has prodded the easy-going Michel, whose strongest expletive is "Judas Priest," into being a bit more confrontational, GOP lawmakers said yesterday. But for the most part he has stuck to the methods of conciliation developed since arriving in the House 29 years ago.

For instance, when House Republicans marched out in protest over the seating of Democrat Frank McCloskey (D-Ind.) in a contested Indiana election, Michel quickly returned and shook McCloskey's hand, upsetting some Republicans.

"He's a decent human being, with a capital D,H,B," said Rep. Vin Weber (R-Minn.), one of the younger GOP lawmakers who has not always agreed with Michel's strategic decisions.

It was not particularly surprising therefore that having led the fight to stop the tax-overhaul bill a week ago, Michel responded to a last-minute plea from Reagan and found a face-saving way to give the president another vote. It also explains why Michel also chose not to take the floor and speak against the tax bill even though he would like to see it die.

"What's that old saying? If you can't say something nice . . . ," Michel said yesterday. Especially, he acknowledged, if the issue happens to be his president's most pressing priority