QUEENS — A rooftop farm in Long Island City is turning trash into treasure.

Brooklyn Grange, which runs a one-acre rooftop farm on the Standard Motor Products Building on Northern Boulevard, is now home to a solar-powered composting system that breaks down food scraps collected from neighborhood residents and restaurants.

The system is the handiwork of the Sanitation Department's NYC Compost Project Local Organics Recovery Program, hosted by Build It! Green NYC, an Astoria nonprofit that sells salvaged building materials.

"Since the farm is on a rooftop, we chose to take advantage of all the sunlight that’s up there," said Chris Bivens, a project coordinator for the Compost Project, which encourages residents to compost as a way to cut back on the amount of food waste they discard.

The group hosts food scrap drop-off sites around Astoria, including at several libraries and the Broadway N/Q subway station. The waste is composted and then used to enrich the soil at Brooklyn Grange's farm and in parks around Queens.

Much of the food scraps come from Coffeed, a locally-sourced coffee roaster and cafe located on the first floor of the farm's building.

The neighbors have a uniquely green partnership. Coffeed uses ingredients harvested from the farm upstairs in many of the dishes on its menu, and then brings its coffee grounds and food waste to the roof to be composted.

"This system is great," Bivens said. "We have a really small footprint on the farm up there."

He said the new solar-composting system was designed and donated by the green engineering group O2Compost, and consists of four large wooden bins and a series of solar panels.

The panels harness energy from the sun to power a fan that blows air through the food scraps stored in the bin. That helps fuel the microorganisms that break down the organic matter, speeding up the composting process.

"Their byproduct is what we're looking for, which is a soil compost," Bivens said, saying organic matter in the soil is important in helping plants thrive.

"It's really important for the farm to have that organic matter content that the plants love."