CHICAGO, SEPT. 21 -- Gov. James R. Thompson (R) signed a sweeping set of laws to combat AIDS today, allowing health officials to trace victims' sex partners and requiring tests for couples wishing to marry.

The legislation also will allow health officials to quarantine victims under some circumstances and require schools to teach youngsters in grades 6 through 12 about sexual abstinence.

Thompson, saying he was trying to craft a balanced, fiscally sound policy to deal with a complicated medical dilemma, vetoed measures requiring AIDS tests for prisoners and hospital patients between ages 13 and 55.

Of 17 acquired immune deficiency syndrome measures sent to his desk, Thompson approved 10, most of which take effect Jan. 1, vetoed four and returned three with changes.

He strengthened safeguards against disclosing AIDS test results by exempting them from the federal Freedom of Information Act, but also required that school principals be notified about the presence of a student with AIDS in the classroom.

Many of the measures, such as those for tracing sexual contacts and quarantining individuals who would endanger the public health, strengthen or expand current practices of the Illinois Department of Public Health.

The contact-tracing bill also encourages people with sexually transmitted diseases to notify those exposed to the disease. Health officials may get a court order to quarantine AIDS patients, but only when there is "clear and convincing evidence the public welfare is significantly endangered."

While schools will be required to teach older youngsters about sexual abstinence and AIDS, a parent or guardian could elect not to have a child take the AIDS course.

The legislation also provides that:A judge may order that some people convicted of sex offenses or narcotics-related crimes be tested for AIDS. Hospitals must allow patients to designate blood donors of their choice. People reporting sexually transmittable diseases in good faith are protected from civil and criminal liability, while those who knowingly spread false information are subject to prosecution.