Fire crews from across Somerset battled through the night to save 100 tonnes of hay.
The fire, at Middle Thrupe Farm, Maesbury, blazed for over seven hours and could be seen in the night sky for miles around.
One resident said: "I could smell smoke throughout the house and couldn't find the cause until I went outside and realised it must be a large blaze over the Mendips."
Fires services fromShepton Mallet, Wells, Street and Yeovil supplied four fire engines, a water carrier and a command support unit as they battled through the night to get the inferno under control.
They jumped onto the farm's diggers to move as much of the hay from the barn before the flames reduced them to ash on Thursday morning.
By 3am two thirds of the hay had been moved to a field a safe distance from the burning barn.
The fire had spread to adjacent farm buildings and silage stock and the fire was eventually contained at around 3.30am with help from pump relief units from Bridgwater, Frome and Glastonbury.
Shepton Mallet Fire Chief Graham Brown, one of the officers in charge at the scene, said that the cause of the fire was still under investigation.
He said: "The hay was only put into the barn in the seven to 10 days before the fire.
"That time period is when hay generates most heat and often internally combusts.
"The cause could either have been arson or internal combustion and investigations are on-going."