A crucial medicine to treat childhood leukemia is in such short supply that hospitals across the country may exhaust their stores within the next two weeks, leaving hundreds and perhaps thousands of children at risk of dying from a largely curable disease, federal officials and cancer doctors say.

“This is dire,” said Valerie Jensen, associate director of the Food and Drug Administration’s drug shortages program. “Supplies are just not meeting demand.”

The drug is methotrexate, and the cancer it treats is known as acute lymphoblastic leukemia, or A.L.L., which most often strikes children ages 2 to 5. It is an unusually virulent cancer of white blood cells that are overproduced in bone marrow and invade other parts of the body.

The cancer commonly spreads to the lining of the spine and brain, and oncologists prevent this by injecting large quantities of preservative-free methotrexate directly into the spinal fluid. The preservative can cause paralysis when injected into the spinal column, so cannot be used for this disease. Methotrexate is also used to treat rheumatoid arthritis.