Is Seafoam safe?

With a code reader, and engine analyzer, and a vacuum gage your problem can be diagnosed and solved properly. A can of Seafoam contains none of these things.

You need a better shop. Your mechanic is guessing. Skip the Seafoam and find a good owner-operated shop run by a good diagnostician rather than a parts changer.

Note: there are a number of possibilities including BUT NOT LIMITED TO weak ignition performance (a bad coil perhaps) and a bad injector.