SAN LUCAS TOLIMÁN, Guatemala — When coffee rust attacked the farms clinging to the volcanic slopes above this Mayan town, the disease was unsparing, reducing mountainside rows of coffee trees to lattices of gray twigs.

During last year’s harvest, Román Lec, who grows coffee on a few acres here, lost half his crop. This year, he borrowed about $2,000 for fertilizer and fungicide to protect the plants, as he did last year. But the disease returned and he lost even more.

“There are nights when you cannot sleep, thinking how to pay back the money,” said Mr. Lec, 65.

A plant-choking fungus called coffee rust, or la roya, has swept across Central America, withering trees and slashing production everywhere. As exports have plunged over the last two years, the effects have rippled through the local economies.

Big farmers hire fewer workers to pick the ripe coffee cherries that enclose the beans. Smaller farmers go into debt and sell livestock or tools to make up for the lost income. Sales fall at local merchants. Teenagers leave school to work on the farm because their parents can no longer hire outside help. At the very end of the chain are the landless migrant workers who earn just a few dollars a day.