Secretary of Health, Education and Welfare Patricia Roberts Harris accused the city of Chicago yesterday of 40 years of deliberate school segregation and rebuffed its request for millions of dollars in emergency school aid.

She warned that unless the city moves in 30 days to show that it is willing to end classroom segregation, she will send the matter to the Justice Department -- a step that could trigger court-ordered busing and a judicial desegregation plan for the giant Midwestern city.

Yesterday's action in the long-festering Chicago case was Harris' first major decision on civil rights since succeeding Joseph A. Califano Jr. as secretary of HEW in July.

Califano's attempts to force North Carolina to take steps to overcome segregation vestiges in its university system generated hatred in the state and helped lead to his ouster, many believe.

Civil rights leaders told Harris when she came in that they hoped she would not shrink from tough enforcement, even though it could be politically risky.

Harris, in a statement yesterday, said HEW in April concluded a long review that "conclusively found that Chicago schools are illegally segregated." The HEW study said that Chicago officials had deliberately fostered racial separation over a 40-year period by using zoning, school siting and boundary policy and by deliberate assignment of black teachers to black schools.

Since then, Harris said, Chicago has come up with plans to end racial assignment of teachers, to end segregated classrooms within integrated schools, to beef up bilingual education for Hispanic children and to protect minority teachers.

However, she said, it has not submitted a plan to end assignment of pupils to racially segregated and overcrowded schools. Department sources said that out of nearly 500 schools, only about 20 are really racially desegregated. Although only about a fifth of Chicago's students are white, many schools are predominantly white, leaving the others virtually all black.

HEW's office of civil rights, Harris said, in an attempt to demonstrate how desegregation could be achieved, drew up a sample plan involving pairing and clustering of schools. That plan would have involved transportation of 114,000 students, with a goal that no school be more than 50 percent white.

The plan -- which wasn't mandatory, merely a demonstration -- showed, Harris said, "that it is feasible and practical to desegregate 60 percent of the schools in Chicago and 55 percent of the students."

Instead, Chicago submitted to her for "information purposes only" a plan drafted by School Superintendent Joseph Hannon which the school board didn't endorse but said it would review later.

Harris said that because Chicago has never endorsed or committed itself to any plan to end the "illegal segregation," she had little choice but to deny about $2 million to $4 million in emergency school aid sought by the city. She said such funds can only go to schools found in compliance with civil rights requirements. She said a Sept. 15 deadline on the application was set by law and she declined to extend it or waive the compliance requirement.

As for the Hannon plan, which is based on voluntary transfers of students out of overcrowded schools Harris aides said her department "is studying it" and probably wouldn't comment unless the school board actually proposed it formally.

The crux of the dispute in HEW's finding that Chicago children routinely continue to be assigned to local public schools which are virtually all black, and which were deliberately made that way in the past by policies of the school system.