The U.S. government spent more than $18 billion last year funding drugmakers to make a Covid vaccine, an effort that lead to at least five highly effective shots in record time. Now it’s pouring more than $3 billion on a neglected area of research: developing pills to fight the virus early in the course of infection, potentially saving many lives in the years to come.

The new program, announced on Thursday by the Department of Health and Human Services, will speed up the clinical trials of a few promising drug candidates. If all goes well, some of those first pills could be ready by the end of the year. The Antiviral Program for Pandemics will also support research on entirely new drugs — not just for the coronavirus, but for viruses that could cause future pandemics.

A number of other viruses, including influenza, H.I.V. and hepatitis C, can be treated with a simple pill. But despite more than a year of research, no such pill exists to treat someone with a coronavirus infection before it wreaks havoc. Operation Warp Speed, the Trump administration’s program for accelerating Covid-19 research, invested far more money in the development of vaccines than of treatments, a gap that the new program will try to fill.

Dr. Anthony Fauci, the director of the National Institute of Allergy and Infectious Diseases and a key backer of the program, said he looked forward to a time when Covid-19 patients could pick up antiviral pills from a pharmacy as soon as they tested positive for the coronavirus or develop Covid-19 symptoms.

“I wake up in the morning, I don’t feel very well, my sense of smell and taste go away, I get a sore throat,” Dr. Fauci said in an interview. “I call up my doctor and I say, ‘I have Covid and I need a prescription.’”

Dr. Fauci’s support for research on antiviral pills stems from his own experience fighting AIDS three decades ago. In the 1990s, his institute conducted research that led to some of the first antiviral pills for H.I.V., “protease inhibitors” that block an essential virus protein and can keep the virus at bay for a lifetime.

In the early 2000s, researchers found that an antiviral called sofosbuvir could cure hepatitis C close to 100 percent of the time. Tamiflu, an over-the-counter pill for influenza, can cut the time it takes to recover from an infection, and reduce the chances that a bout of the flu will land someone in the hospital.

At the start of the pandemic, researchers began testing existing antivirals in people hospitalized with severe Covid-19. But many of those trials failed to show any benefit from the antivirals. In hindsight, the choice to work in hospitals was a mistake. Scientists now know that the best time to try to block the coronavirus is in the first few days of the disease, when the virus is replicating rapidly and the immune system has not yet mounted a defense.

Many people crush their infection and recuperate, but in others, the immune system misfires and starts damaging tissues instead of viruses. It’s this self-inflicted damage that sends many people with Covid-19 to the hospital, as the coronavirus replication is tapering off. So a drug that blocks replication early in an infection might very well fail in a trial on patients who have progressed to later stages of the disease.

So far, only one antiviral has demonstrated a clear benefit to people in hospitals: remdesivir. Originally investigated as a potential cure for Ebola, the drug seems to shorten the course of Covid-19 when given intravenously to patients. In October, it became the first — and so far, the only — antiviral drug to gain full F.D.A. approval to treat the disease.

Yet remdesivir’s performance has left many researchers underwhelmed. In November, the World Health Organization recommended against using the drug.

Remdesivir might work more effectively if people could take it earlier in the course of Covid-19 as a pill. But in its approved formulation, the compound doesn’t work orally. It can’t survive the passage from the mouth to the stomach to the circulatory system.

Researchers from around the world are testing other antivirals already known to work in pill form. One such compound, called molnupiravir, was developed in 2003 by researchers at Emory University and has been tested against viruses including influenza and dengue.

In partnership with Ridgeback Biotherapeutics of Miami, the Emory team carried out experiments in mice that were so impressive that Merck approached them to bring the drug into human clinical trials for Covid-19.

“We thought this molecule was really amazing,” said Daria Hazuda, vice president of infectious disease and vaccine research at Merck.

In a trial of hospitalized patients, however, molnupiravir seemed to have no effect on the disease. In April, the companies announced they were scrapping the trial.

“I see that, and I’m like, ‘Yeah, no duh,’” said Dr. Tim Sheahan, a virologist at the University of North Carolina. “It’s not surprising to me that those kinds of medications would not make a dramatic improvement in someone’s outcome when they’ve been sick for several days.”

The companies began a second study last fall, this time testing the drug on people recently diagnosed with Covid-19. That trial is continuing, and Merck is recruiting volunteers with a higher risk of infection, such as older people with obesity and diabetes. Dr. Hazuda said the trial should deliver clear results by October.

Last year, the government’s funding of Covid-19 treatments focused on a handful of candidates, such as monoclonal antibodies and remdesivir. Many other studies on antivirals were small and underfunded. In January, the incoming Biden administration began designing a new program dedicated to antiviral pills.

Last week saw the first results of this planning. The Department of Health and Human Services announced that it would purchase from Merck 1.7 million doses of molnupiravir at a cost of $1.2 billion, provided that the current trial leads to authorization by the Food and Drug Administration. The government may seek similar deals for two other antivirals far along in clinical trials, according to Dr. David Kessler, the chief science officer of the Biden administration’s Covid-19 response team.

The hope “is that we can get an antiviral by the end of the fall that can help us close out this chapter of the epidemic,” Dr. Kessler said in an interview.

One of the drugs the government is considering is AT-527, developed by Atea Pharmaceuticals. The compound has already proven safe and effective as a treatment for hepatitis C, and early studies suggested it might also work against Covid-19. Roche has partnered with Atea to test it in people, and the companies are currently running a late-stage clinical trial.

The other drug on the government’s radar was created by scientists at Pfizer, adapted from a molecule initially designed in the early 2000s as a potential drug for SARS. That drug had sat on the shelf for years, but last spring, the scientists decided to modify its structure so that it would work against the new coronavirus’s protease. More than 200 Pfizer researchers joined forces on the effort on the molecule, known for now as PF-07321332.

The drug had been designed to be taken intravenously, but the Pfizer researchers succeeded in altering its structure to work as a pill. When mice were given the drug orally, it reached high enough levels in the body to block the coronavirus. Pfizer launched a clinical trial in March to study its safety in people, and expects to move to later-stage testing next month.