Housing and Urban Development Secretary Patricia Roberts Harris has forced a major shakeup in her department's fair housing division aimed at intensifying civil rights pressure on localities across the country.

Harris has privately complained that the division has been ineffective, and her frustration deepened earlier this year when it produced what one source called a "sloppy" draft report on Philadelphia's failure to spend HUD funds in certain black areas of the city.

One casualty in the shakeup was Assisstant Secretary Chester C. McGuire Jr., one of the highest ranking blacks in the Carter administration, who resigned yesterday as head of the Fair Housing and Equal Opportunity Division.

McGuire's deputy, Herman (Tex) Wilson, also resigned.

HUD's civil rights enforcement powers are relatively weak, but the department does have the power to withhold community development grants from localities that deny grant benefits to minorities or women.

Until recently, HUD's reviews of how communities are spending their development funds have been mostly pro forma, but Harris has ordered closer looks, and McGuire's division is responsible for them.

McGuire said in a telephone interview that he was not being forced out of office, and Harris aides stressed that she did not ask for his resignation.

However, one source said Harris, distressed because "nothing was happening in the division," ordered a review of its operations by an outside consultant last March. In late June, after reading the highly critical report, she asked McGuire for his comments, the source said, adding:

"If someone handed me a report like that, my resignation would have been tendered by the end of the day."

The resignations of McGuire and Wilson, who is also black, are expected to create a sensitive issue for the administration because relatively few blacks are in high leadership positions. Harris, herself a black, has made it clear that she hopes McGuire's replacement will be a black who is well known fair housing circles, one sources said.

The Philadelphia case, while not crucial in McGuire's leaving, is seen by sources in and out of HUD as indicative of the division's problems.

The Division began a close look last fall at how Mayor Frank L. Rizzo was spending the development block grant money after the city applied for nearly $63 million in new funds.

In late March the division produced a draft report, which an outside source called "terrible" - they didn't document their case that the city was spending the money mostly in white areas."

Another source said of the politically thorny issue: "The last thing you want to do is take on Frank Rizzo and get beaten on the head because you're wrong or fuzzy on the facts."

Responsibility for "making the case" was taken over by HUD's Office of the General Counsel, which, working with McGuire's division, finally produced a report that forced Rizzo to agree in May to put more development money in the black northcentral part of Philadelphia, improve streets and upgrade neighborhoods in black areas and search for blacks eligible for the city's homesteading program.

McGuire said yesterday that some of his division's initial report "was sloppy, but the block grant program is very complicated, and this was our first major comprehensive review of a big city."

Sources said the biggest factor in McGuire's leaving was the analysis of his division's operations by Washington consultant George Schermer, who is considered an expert both in management and in fair housing.

The Schermer report has not been made public, but sources said it criticized the division's top leadership and administration ability and found poor coordination between its office here and its field offices. It also said the division's responsibilities were not clearly defined or understood and that many of its staffers were mediocre, the sources said.

McGuire said he thought the Schermer findings on the need for training and coordination "are very sound." Asked about the criticism of the top leadership, he said, "I thought it was a little reckless. I'd just as soon forget it."

McGuire's deputy, Wilson, could not be reached for comment. He is 43, a former antipoverty official in the Johnson administration and a former civil rights lawyer in Mississippi.

McGuire, 41, was an assistant professor in the department of city and regional planning at the University of California at Berkeley before taking his current post in April 1977. He said he plans to work in the Washington area with a firm dealing with housing finance and inner city investment.

McGuire said he is a specialist in housing economics and not civil rights and wants to "get back to what I know best." He said the fair housing division has traditionally been regarded as a stepchild at HUD and added, "Trying to administer civil rights in an agency that is not a civil rights agency goes against the grain of a lot of people. It will take a long time to turn that around."

But he noted that the division's backlog of housing discrimination complaints had been cut from more than 1,000 to fewer than 100 and said, "I think things are better now than when I found them."