Chemistry and craftsmanship are being combined here to bring the practical advantages of synthetic fabrics to the ancient beauty of batik cloth.

At stake is the future of Indonesia's traditional batik industry, for which the country, and particularly the island of Java, has been famed for well over 1,000 years.

The market at home and abroad for traditional cotton batik garments, which wrinkle almost as soon as they're put on, has fallen off under the pressure of synthetics and mass-produced imitation batiks.

"Only wealthy Indonesia and a few foreign collectors are interested in the traditional fabric these days," said Mrs. T.T. Soerjanto, a senior staff member of the government-run Batik and Handicraft Research Institute in this central Java city. Jogjakarta has long been the center of the Indonesian batik trade.

At the same time it is working on the latest developments in permanent press and synthetics, the institute is also striving to keep alive the tedious, ancient skills of traditional batik making.

Three-month courses for Indonesians as well as shorter ones for foreigners seriously interested in learning the craft are taught at the institute, which was established in 1950.

"I suppose you could say we have a dual mission here," Soerjanto said. "We're saving batik making from extinction by keeping alive the old ways while we're helping build an export industry by combining the old ways with the latest textile industry developments."

So far, the results of combining the old and the new have been spotty. "We've had quite good results in making permanent press cotton," Soerjanto told a visitor to the institute recently. "But the synthetic fibers, when they're blended with the cotton, just won't take the dyes we normally use."

Because batik dying must be done on a completed sheet of material, rather than on the fires before weaving, institute chemists have had to use one kind of dye which is absorbed by the cotton and then another special dye of the same color which is absorbed by the synthetics.

"This hasn't been terribly successful," said Soerjanto, "and we're continuing to experiment toward a single dye which will work for both natural and synthetic fibers."

The institute has had better luck with adapting traditional batik methods to silk. "We've been able to use a broad variety of colors on silk by altering our standard dyes," she said.

Craftsmen at the institute use chemical dyes imported from Europe as well as traditional vegetable colorings. The difference in time and cost is enormous. A vegetable-dyed piece of cloth in the standard sarong length, about six feet, requires 30 dippings over a two-week period, while a chemically treated sarong is finished in half an hour.

The lowest quality cotton sarong dyed with chemicals sells in Jogjakarta stalls for the equivalent of $1.50 while the finest, vegetable-dyed garment costs as much as $110.

But the dying itself is just a small part of the batik-making process. What takes longest, and requires the greatest skill, is the waxing. Artist must trace complex designs on the cloth with molten wax.

Using an instrument known as a "chanting," a three-inch bamboo handle fitted to a tiny copper funnel and a fine hollow tube the artist trace delicate designs which have been previously applied free-hand or by craftsmen using intricately designed copper blocks.

Some 15,000 artist, mainly women, do the waxing for ordinary quality batik in their homes in Jogjakerta, Soerjanto said. They send the waxed cloth to factories for dying. "Only the best quality waxing is done in the factories," she explained.

Once the unwaxed portions absorb a dye, the cloth must be boiled in water to remove the wax. Then it is dried and a new portion is waxed. Then back to the dye vats again. The procedure goes on until all the colors have been applied and all wax has been removed.

The advent of chemical dyes meant that batik makers could employ and almost endless variety of colors, rather than just the traditional black and brown, which are still prized for their mellow shadings by a handful of connoisseurs.

A development of dying and then bleaching before removing each wax application, which was invented at the Jogjakarta institute, has enable craftsmen to produce colors side-by-side, without the usual black outline.

The institute has also developed an ultra fine quality of pure cotton known as voillissima. Shirts and dresses made of this material are feathery light and loved by Westerners living in Indonesia who find the humid heat oppressive.

Until 1958, Indonesida imported most of its high grade cotton from China, Japan and India. Now, a range of six different qualities is produced in the country.

Because the institute's course is a serious one, teaching students theory, chemical formulation as well as artistic skills and production, with an eye to keeping a national resource alive, not many foreigners attend.

Much more popular among Westerners traveling through Jogjakarta are brief, practical classes, such as the one taught at the Intensive and Informative Batik Course by Hadjir.

Hadjir, a grammer school art teacher, has just one name, like many Javanese. He runs the course at his small home near the city's lovely, ancient "Water Palace," the Tamran Sari.

Classes begin at 2 p.m., when Hadjir returns from school, and end at 6 p.m., in time for his evening prayers. "I'm a very devout Moslem," he confided to a visitor one evening.

As he spoke, a young Swedish couple, Bength Stocklassa and Helene Carlsson, were tidying up their materials after finishing their first day of the course. "So far, we've learned about mixing dyes and we traced a pattern with wax," said Stoklassa. "We'll probably take another four lessons." The cost is just over $2 a day.

Hadjir, a neat and metholdical man, took out a stack of notebooks containing snapshots and comments from many of his 600 former students, some of them going back to 1971, when he got the idea of teaching batik making to foreigners.

"Taman Sari's presence creates a marvelous atmosphere in which to discover the magic of batik," wrote Lorri Webber, an American, while an unsigned note said simply, "a delightful way in which to spend a rainy afternoon."