There was a flight that was legal in a SEP in the States, an accident occurs, who is PIC?
Depends who has a better lawyer. In reality, they would look at who was assuming PIC before the flight, OR who signed out for the aircraft, who was manipulating the controls, who paid for the rental (who the owner was), which name was on the flight plan if filed, etc...
Typically though, the pilot under the hood can log PIC the entire flight and the safety pilot can only log flight time while the other pilot is under the hood during VMC conditions. Once the hood comes off or once the aircraft is in IMC conditions, the safety pilot is no longer a required crew member and can no longer log the time.