Rep. John B. Anderson of Illinois, an articulate spokesman for an ailing breed - the liberal republican - declared formally yesterday that he will seek the GOP nomination for president in the 1980 election.

He did so with some of the same rhetoric that other Republican presidential hopefuls have been using - criticism of deficit spending and of weak leadership in the White House - but he also emphasized points that have not been heard much in his party's presidential sweepstakes thus far.

"I believe that government - for all the stigma that term bears these days - can still represent an answer to some of our problems," Anderson said. "There is a future for those who believe the Republican Party has to . . . recognize a collective responsibility for those in need."

Anderson joins a feild that includes six other formally declared candidates and at least two more who plan to announce this year. But since the only other liberal contender, Sen. Lowell Weicker (R-Conn.), has already dropped out, Anderson will have unimpeded aim at the party's liberal - or, as he prefers to call it, "progressive" - wing.

It is, however, a diminshing target. Judging from opinion polls and the party's membership in Congress, the GOP nationwide seems to have moved noticeably to the right in recent years. Reflecting this movement, all of Anderson's major contenders for the presidential nomination sound more conservative than the Republicans' candidate in 1976, former president Ford.

At his announcement yesterday, Anderson, standing before a larger-than-life portrait of George Washington in an elegant Capitol meeting room, cheerfully agreed that his policy positions and his limited name recognition would seem to make him an underdog.

But he declared, with characteristic self-assurance, that he would pursue a "Middle Western strategy" - relying on a core of support from liberal and moderate Republicans in midwestern states as the foundation for his campaign.

The candidate, a ruddy-faced, white haired 57 year-old, is married and the father of five children. He was born in the northwestern Illinois district he now represents, and graduated from the University of Illinois and its law school before taking a master's degree in law at Harvard.

After serving in the Army and as a county prosecutor, he was elected to Congress in 1960 and has served there since. On Capitol Hill, he has won respect from members of both parties and has received unusually complimentary treatment from the press. For 10 years he has been chairman of the House Republican Conference, the third ranking position in the House GOP hierarchy.

But Anderson has also been accused of being too liberal for, and too remote from, his home district. In 1978 an extremely conservative opponent gave Anderson a tough primary fight; Anderson won, but when he came back to Congress in January, he found himself a target of criticism from the generally conservative Republican House freshmen who said he was too far left to hold a party leadership position.

In an interview recently, Anderson said he would not contest the label "liberal Republican" for himself, "as long as you make it clear that is a completely different species from a liberal Democrat."

The main difference, as he explained it, is that he is not quite as convinced as a liberal Democrat would be that government programs can heal social ills. Further, he said, he is much less tolerant of large budget deficits.

Anderson said yesterday that, unlike some other Republicans, he expects President Carter to be the Democratic presidential nominee in 1980. Anderson said the president has "temporized and vacillated while problems have multiplied" and he castigated Carter for economic policies that tend, he said, to exacerbate inflation.

His own initiatives, he said, would include dealing with the problems of poverty, race discrimination and unemployment. He also said it is "shameful" that the United States spends more on military research than on research into health and other domestic problems.

The congressman acknowledged that these have not been priority concerns for everyone in his party, but he said his candidacy would have to draw on some traditionally Democratic elements of the electorate, including blacks. "There wasn't any excuse for Jimmy Carter's getting 91 percent of the blank vote in 1976," he said.

Rep. Edward Derwinski (R-I11.), a friend of Anderson's who attended yesterday's announcement, observed afterward that such talk may not help Anderson in GOP primaries.

"If he ever got the nomination," Derwinski said, "the way he articulates the issues, John would have a good chance to win. But with his rhetoric, he's not going to be nominated."

That states the conventional wisdom, and Anderson agrees that his chance of being nominated is slim. But Anderson has decided not to seek reelection to the House, or run for Illinois' open Senate seat, so that he can concentrate on the presidential campaign.

Why? During a lonely campaign trip through Iowa last fall, Anderson addressed that question. "If I could teach my party a lesson," he said, "if I could show them that there has to be room for somebody who's not all the way to the right - that would make the whole thing worth it." CAPTION: Picture 1, Anderson receives kiss from wife while surrounded by daughters, from left, Diane, Susie, Karen and Eleanora.

by James K. W. Atherton - The Washington Post; Picture 2, Anderson: "Government can still represent an answer to some of our problems."