WASHINGTON (AP) _ It has been less than five years since the first signs of the AIDS epidemic were recognized in the United States. Less than five years since doctors first puzzled over a rare cancer unaccountably afflicting young men.

In the first weeks and months, the mystery deepened. The young men were almost exculsively homosexuals. They suffered from a variety of strange ailments. An unusual form of pneumonia. Rampant fungal infections.

Illnesses struck in waves, until doctors realized the young men had been stripped naked of their defenses.

The dawning awareness that the strange diseases were but symptoms of a more profound disorder triggered a painstaking, methodical scientific investigation. In a few years scientists have accumulated an enormous amount of information about what is now called the acquired immune deficiency syndrome.

They know its targets, its cause, its means of spreading, its effects.

''There's no disease in the history of medicine where the basic science has moved faster,'' said Dr. Robert Gallo of the National Cancer Institute, one of the discoverers of the virus now known to cause AIDS.

However, the remarkable discoveries have not led to a treatment. The illness remains incurable. And the much discussed vaccine to prevent spread of the illness to healthy people remains a hope, a dream.

Research is progressing rapidly on both fronts. Doctors have identified several promising drugs that might at least stop growth of the virus in its victims, if not destroy it altogether. Human experimentation has begun.

In the second area of investigation, scientists are working very hard to prevent the spread of the disease with a vaccine.

Numerous findings hint that the development of an AIDS vaccine might be possible. No one can say when.

---

At the center of efforts to develop an anti-AIDS drug is Dr. Samuel Broder, director of the National Cancer Institute's clinical oncology program, which conducts human trials of experimental cancer therapies.

''I feel that the virus that causes AIDS can be stopped,'' Broder said in an interview in his office. ''The question I don't know is how long that will take.''

Advances to date ''encourage me to think that it will not be in the very distant future,'' he said.

Among the encouraging signs are the rapid progress in deciphering the genetic code of the virus, the discovery of a viral gene that boosts the virus's replication, the production of workable quantities of viral fragments that can be tested as possible candidates for a vaccine, and the development, in his lab, of a quick screening test to evaluate possible anti-AIDS drugs.

The test allows Broder and colleagues to determine in four or five days whether a new drug has any activity against the AIDS virus.

''What you can do is carry on a dialogue between a virus and a new agent,'' he explained. ''You can make minor modifications of the molecule and do your own little interrogatories with the system.

''So you can very quickly find the inherent structure of the molecule you want to deal with. And we believe, at least in one family of drugs, that we have a blueprint for how to chemically engineer drugs that have quite a startling activity against the virus.''

One of those drugs is now in the first stage of human testing.

In a nearby building on the campus of the National Institutes of Health in Bethesda, Md., where the cancer institute is located, Dr. Anthony Fauci of the National Institute of Allergy and Infectious Diseases is investigating a natural substance called interleukin-2 that seems to boost the immune system.

Such an immune-system booster might be necessary in combination with anti- viral drugs to combat AIDS, Broder said.

Other such drugs are being investigated elsewhere, and many researchers, including Broder, are coming to believe that AIDS treatment might, like cancer treatment, ultimately consist of doses of multiple drugs either together or in sequence.

''Therapy is likely to be required for a long period of time,'' said Broder. ''Whatever therapies are found, they will have to at least be given on an intermittent basis, and possibly intermittently for the rest of the patient's life.''

The reason, he said, is that the AIDS virus apparently can lay dormant in cells, where it can be periodically re-activated ''by signals we don't know,'' Broder said. The virus can even insert a genetic copy of itself into the genetic material of a living human cell.

''As long as it's laying there quietly, you can't get at it. It may be difficult to know it's there,'' he said.

Most of the existing strategies for fighting AIDS are designed to attack the virus's reproduction. An essential element of the reproduction is an enzyme called reverse transcriptase, which the virus uses to translate its genetic material - RNA, or ribonucleic acid - into human-type genetic material - DNA, or deoxyribonucleic acid.

If reverse transcriptase is blocked, the virus cannot reproduce.

The cancer institute and other researchers have had some success in very early tests with suramin, a drug that has long been known to interfere with reverse transcriptase, although no one knows how it does so.

HPA 23, the French drug that lured Rock Hudson and other American AIDS patients to Paris, also blocks reverse transcriptase.

Broder believes new compounds now being devised will be better than either of these, and his quick-screening test to determine drug activity against AIDS is allowing him to proceed as rapidly as possible in developing additional candidates for future human testing.

He tempers his optimism, however, with experiences from cancer research.

''There are obstacles that cannot necessarily be foreseen in doing a translation of a basic science observation into a clinical practice,'' he said. ''That can be a real unknown.''

---

The search for a vaccine is equally full of unknowns. Heartening discoveries one week are offset by discouraging findings the next.

Gallo has reported that samples of AIDS virus can vary in the make-up of the so-called viral envelope, the outer surface or ''skin'' of the virus.

That is one of the most disturbing features of the virus, he said. A second is that it attacks the very cell that protects the body from viral infections, a white blood cell called the T-cell.

''If this virus happened to evolve the third weapon, of being virulent - that is, passing quickly from one person to another - you would have to regard it as the most dangerous organism in the history of man,'' Gallo said.

The virus does not seem to be evolving in that direction, Gallo said, and researchers still maintain the virus cannot spread through casual contact. And Gallo remains optimistic.

''I would never answer that it cannot be stopped, even if I firmly believed it. It would raise and enormous alarm ... and who can predict unexpected new technology?'' he said.

A precedent for an AIDS vaccine exists in a recently marketed vaccine to protect cats from leukemia. The leukemia is caused by feline leukemia virus, an organism similar to the AIDS virus that can also cause AIDS in cats.

While that is a hopeful development, it is tempered by the vaccine's effectiveness: it works in only about half of the cases. For human AIDS, said Gallo, ''that's not good enough.''

Vaccine development is tricky. A vaccine must mimic a disease organism, thus causing the body to mount an attack against it, but must not cause disease.

Once the body has developed an immunity to the vaccine agent, it should be able to quickly find and kill the corresponding disease agent.

Researchers are now looking for a substance on the outside of the AIDS virus, in a position where the body's immune system can see it, that is common to all variations of the virus and thus would provide complete protection.

Then they must determine whether the substance is capable of stimulating the body's defenses. Some substances are, others aren't.

An initial assessment of a possible vaccine agent is being made at the cancer institute by Dr. Peter Fischinger, the institute's associate director, and others.

Rhesus monkeys have been injected with the substance, which was extracted from the envelope of AIDS virus samples. The substance did stimulate their immune systems.

Soon researchers will inject AIDS virus into the monkeys to see whether they are protected. It is unlikely they will be, Fischinger said, noting that few experiments work the first time. But if the monkeys have even partial resistance to the virus, the experiment will be judged a success.

Fischinger and colleagues can then refine and alter the vaccine agent to try to enhance its effectiveness.

He didn't minimize the difficulty involved. ''I think we have a very challenging agent,'' he said.

---

The cancer institute scientists are not the only ones studying AIDS. Many researchers at institutions around the country are busy exploring similar avenues, using similar strategies and encountering similar problems.

Mysteries remain. Not all people exposed to the AIDS virus develop AIDS. Are some immune? Or will all of them get AIDS in time? Does it take a large dose of virus or repeated exposure to it to produce the disease?

Will AIDS only take hold in a person whose immune system is already weakened, as one recent study suggested? Do other agents, such as hepatitis B virus, play a contributing role, as another study hints?

Will patients who get the pre-AIDS illness now referred to as AIDS-related complex go on to develop AIDS, or will they get better?

A cautious optimism, a guarded hopefulness seems to be the attitude of many AIDS researchers. As the illness spreads, they are sustained by a conviction that the virus can, indeed, be stopped.

''I believe,'' Broder said, ''that individuals who do not hold that belief will fail.''