GENEVA, N.Y. — Across the country, hundreds of kinds of apples were meticulously developed by orchardists over the last couple of centuries and then, as farms and groves were abandoned and commercial production greatly narrowed the number of varieties for sale, many were forgotten.

Some of this horticultural biodiversity, though, has been nurtured by dedicated growers who want to preserve the forgotten flavors and other traits of apples from the past. For example, some of the best apples ever developed for baking pies are no longer grown commercially, experts say, but are still thriving in heirloom orchards.

“They are a piece of our history as a variety and part of our cultural identity,” said Mark Richardson, director of horticulture at the Tower Hill Botanic Garden in Boylston, Mass. “But also some of these varieties may be important for breeding the next generation. They are an insurance policy against a catastrophe.”

A burgeoning threat is coming for apples, though, both of the historical varieties and the popular ones grown in the orchards today. A disease called fire blight, easily managed for a long time in apple and pear orchards, is becoming more virulent as the climate changes and as growers alter the way the trees are configured to produce higher yields. Some researchers say newer varieties may be more vulnerable, too.