An undated photo of Gus Schumacher. (Dan Rosenbaum/Wholesome Wave)

Gus Schumacher, a fourth-generation farmer and third-ranking official at the Agriculture Department, told the story of his epiphany about food hundreds of times.

It was the end of a summer afternoon in 1980 at a farmers market in Boston, and he was helping his brother load up his truck with unsold produce grown on their family property in Lexington, Mass. The bottom fell out of a box of pears, scattering the fruit into the gutter.

There, a young mother with two little boys eagerly gathered them into the folds of her unhemmed shirt. She was a single mom, she explained, dependent on food stamps, which back then made fresh fruit and vegetables prohibitively expensive for her. The pear spill was a bonanza.

For Mr. Schumacher, he would say later, it was a seminal moment in his life. He grew up on a farm, and it had never occurred to him that parents would find it hard to provide their children with fresh fruit and vegetables.

He would change it, he told himself.

Mr. Schumacher — who in a 50-year career also served as the Massachusetts commissioner of food and agriculture, a food project manager and agriculture development officer for the World Bank and finally a co-founder of a nonprofit group that tries to improve affordable access to fresh, locally grown food — died Sept. 24 at his home in Washington. The cause was an apparent heart attack, said his wife, Susan Holaday Schumacher. He was 77.

Since that farmers-market epiphany, Mr. Schumacher helped make food assistance programs more generous in allowances for fresh fruit and vegetables. He also became a force in the farm-to-table movement, encouraging restaurants and retail stores to buy produce locally.

In 2013, Mr. Schumacher received the James Beard Foundation’s Leadership Award for “his lifelong efforts to improve access to fresh local food in underserved communities.”

In Boston, the Globe wrote about a time several years ago when Mr. Schumacher, dining out at tony Hamersley’s Bistro, sat down at a table, reached into a brown paper bag and pulled out a shiny, ripe red tomato. He asked for a serrated knife, olive oil and a plate, then proceeded to make himself a salad.

“Who’s this guy who’s making his own salad?” chef-owner Gordon Hamersley wanted to know. His own tomatoes came from California. Where had Mr. Schumacher’s come from?

“Twenty minutes from your doorstep,” Mr. Schumacher said.

That scene, or a version of it, would play over and over again between 1984 and 1990 when Mr. Schumacher was agriculture chief for Massachusetts. He was always asking chefs whether they knew any farmers who could supply them food directly. He created market coupon programs for seniors and low-income families with children. He chastised breakfast diners for serving English jellies instead of American ones.

“Gus was instrumental in bringing two seemingly obvious groups together who never talked to each other — chefs and farmers,” Hamersley told the Globe. “He’s basically the architect of chefs featuring locally grown produce. As always, there was a team of people with him, but he was sitting in the chair.”

The Washington Post reported on Mr. Schumacher’s work with refugee and immigrant farmers all over the United States. He encouraged them to grow and market their native vegetables, such as amaranth. From New England, the New York Times reported, Mr. Schumacher made personal deliveries of Asian greens that included pea tendrils, Chinese chive blossoms and Cambodian spearmint to the Washington restaurant TenPenh.

August Schumacher Jr. was born in Lincoln, Mass., on Dec. 4, 1939. He grew up on a farm in Lexington, and his father was one of the largest parsnip growers in Massachusetts. His grandfather and great-grandfather were farmers in New York City. They grew winter vegetables in glass-enclosed hothouses.

Mr. Schumacher graduated from Harvard University in 1961 and attended the London School of Economics.

Over his career, he had a variety of consultancies, served as Massachusetts agriculture chief from 1984 to 1990 and was the USDA undersecretary of agriculture for farm and foreign agricultural services from 1997 to 2001.

Since 2008 he had served as founding board chairman of Wholesome Wave in Bridgeport, Conn., which seeks to increase access to affordable, locally grown fruits and vegetables.

His first marriage, to Barbara Kerstetter, ended in divorce. Survivors include his wife of 25 years, Susan Holaday Schumacher of Washington; a stepdaughter, Valarie Karasz of Brooklyn; and two grandchildren. A stepson, Andrew Karasz, died earlier this month.