President Reagan signed legislation Tuesday to provide thousands of poor AIDS victims with AZT, the only drug approved for treatment of the deadly disease, for six more months.

The House averted a possible cutoff of AZT to 6,000 victims of acquired immune deficiency sydndrome by giving final congressional approval late Friday to a six-month extension of the program.Last year, Congress passed a $30 million, one-time-only bill to provide low-income AIDS patients with AZT, which can cost up to $8,000 a year.

States were expected to take over the program Oct. 1, but only a handful have set aside local funds to provide victims with AZT, which has been found to prolong the lives of some AIDS patients.

The AZT program covers low-income victims without private health insurance of those who do not qualify for Medicaid assistance. It also helps victims living in states where Medicaid does not cover such drug costs.

Under the bill, the Health and Human Services Department will provide $10 million for the purchase of the drug and the remaining $5 million will be donated by Burroughs Wellcome Co., the manufacturer of AZT.