Dundee Sheriff Court heard the 43-year-old employee of Wallace Roofing and Building Limited suffered a broken shoulder and collarbone as well as punctures to both of his lungs and fractures to all but two of his ribs.
Emergency services helped the rescue operation following the incident in September 2011 at a house renovation in Falkland.
A trench was being dug with an excavator to help connect the drainage system of the old property with a new extension.
When the workers came across a boulder preventing them from further digging, the excavator was used to try and move the rock.
The injured man, who was in the trench laying the new piping, was trying to help guide the excavator.
During this operation one of the trench walls, nine feet deep, subsided, burying the worker under the dislodged earth.
Workers immediately started digging the soil away from the man’s head to allow him to breathe. He remained partially buried in the trench until the emergency services arrived and dug him free. He remained in hospital for almost three weeks.
An HSE investigation found that the trench had not been supported or ‘stepped back’, to control the risk of the trench collapsing.
Inspectors also found that nobody had formal health and safety training for managing a construction site and that work involving the excavated trench had not been risk assessed.
As a result, workers were given instructions through verbal briefings rather than detailed, mapped out planning.
Wallace Roofing and Building Limited, of Fife, pleaded guilty to safety breaches and was fined £14,000.
Speaking after sentence, HSE Inspector Ritchie McCrae said: “The risks associated with collapsing excavation walls are well known, as are the necessary control measures which could easily have been employed.
“On this occasion, the company failed to identify the risk and consequently there was a total absence of any control measure which would have prevented this incident from occurring.
“The injured worker sustained serious, permanent injury and is extremely lucky to still be alive.”