In the 20 years it took Jacqueline Kennedy Onassis to acquire a rare set of 18th century Indian paintings called "rajput," she never knew she would require the services of the New York City Sanitation Department to preserve them.

That's just what happened last week, when Onassis almost lost 17 of the valuable Indian paintings because a porter in her Fifth Avenue apartment house mistakenly thought they were trash, took the paintings from her back door and threw them out in the garbage. Sent out by Onassis for framing, the framed paintings had been left at her back door when no one answered the deliveryman's ring.

A telephone call last Friday alerted the city's Sanitation Department, which tracked down the crew who had picked up the trash from the apartment building. Sanitation officials instructed the crew to sort through the truck's contents and recover the cardboard-wrapped paintings.

"Luckily, the paintings were one of the last things the men had collected" and had not been squashed by the truck's compactor, said the Sanitation Department's Vincent Romano, who added that the paintings were returned "undamaged" to Onassis' maid. He said the maid reported "they were hung in Mrs. Onassis' room."

The rajput paintings were acquired by Onassis as a result of her friendship with Harvard University economist John Kenneth Galbraith, who was ambassador to India when John F. Kennedy was president. The paintings were described as "fine, valuable stuff," done in the 18th century by Indian artists for India's ruling class of maharaji.

"These paintings are very delicate and were done on paper, meant originally as book illustrations not to be framed," said Milo Cleveland Beach, a professor of art and an expert on Indian art at Williams College in Williamstown, Mass. "I imagine that Mrs. Onassis sent them out to be framed in order to preserve them."

Beach said that many rajput paintings have been lost over the years to termites and white ants, well-known paper eaters who manage to get through the cloth wrappings in which some collectors keep the paintings. Beach said that whatever rajput art is preserved is very valuable, sometimes selling for five-figure prices.

Most rajput art depicts mystical figures in the Hindu religion, especially Hare Krishna. Others are portraits of India's best-known l8th century maharaji. Beach said Onassis' collection was exhibited in the 1960s at Harvard's Fogg Art Museum, which sent it on for exhibit to the Asia Society in New York.