BOSTON – Though the number of farms and amount of farmland in Massachusetts is declining, the Massachusetts Farm Bureau Federation said it found a few bright spots in the U.S. Department of Agriculture's recently-released 2017 U.S. Census of Agriculture.

The federal survey, conducted every five years, found that Massachusetts had 7,241 farms totaling 491,653 acres in 2017, compared to 7,755 farms and 523,517 farming acres in 2012.

Farm Bureau Federation President Mark Amato said his organization was "disappointed, but not surprised" by the findings.

"With a crippling drought a few years ago, increasing expenses and increasingly tough regulations, agriculture in the Commonwealth has been hard hit," he said, referring to the serious drought of 2016.

Though the number of farms and acreage utilized for farming has dropped, the average market value of a Massachusetts farm has risen since 2012.

The average farm is valued at $739,711 or $10,894 per acre, compared to an average farm value of $704,071, or $10,430 per acre, in 2012.

The 7,241 farms in Massachusetts sold $475.2 million worth of products in 2017, the USDA said.

Ranked by sales, the top product category in 2017 was "nursery, greenhouse, floriculture and sod" followed by "vegetables, melons, potatoes, and sweet potatoes," then "fruits, tree nuts, and berries" and "milk from cows." Those top four categories account for about three-quarters of all Massachusetts agriculture sales.

Amato said he was heartened to learn from the census that there are 1,238 "young producers," or farmers who are 35 years old or younger, farming 73,389 acres in Massachusetts. "

It is refreshing to see this large number of young folks interested in farming," he said. The Farm Bureau Federation also highlighted the 204 organic farms in Massachusetts, which in 2017 sold $32.8 million worth of organic products – an increase of six farms and $6.5 million in sales over the 2012 census.

The census of agriculture also reported that the number of Massachusetts farms that are harvesting renewable energy has increased more than 200 percent – there were 1,435 Bay State farms working to generate renewable energy through biomass, solar or other means in 2017 compared to just 465 farms in 2012, the federation said.