The contractor is believed to have been working on the road on Rossett Green Lane when his leg became trapped at around 9am after a trench collapsed on him.
Fire crews were working for seven hours to release him, and finally succeeded just before 4pm.
Inspector Chris Galley of North Yorkshire Police described the rescue operation as 'detailed and challenging'.
The air ambulance was sent to the scene and remained on standby throughout the incident.
The man is currently being treated by paramedics but an update on his condition has not been released.