A four-alarm fire that heavily damaged a former motel in Onset was caused by plumbing work being done as part of the renovation of the building, officials said yesterday. State Fire Marshal Stephen D. Coan and Onset Deputy Fire Chief Jeffrey R. Osswald said in a joint statement that the fire began in the first-floor bathroom where plumbing work was performed Thursday. The fire in the three-story Harborview Inn on South Boulevard in the Onset neighborhood of Wareham was an accident, investigators concluded. The Onset Fire Department first responded just after 11 p.m., a department spokesman said. It took 90 firefighters three hours to bring the fire under control and an additional two hours for firefighters to fully extinguish the fire, officials said.