Those engines have a tach sensor on the port side of the flywheel at the 90 degree position.
This website has Yanmar service manuals which show the position.
Yanmar Marine | Barrus
The most likely problem is that the sensor is dirty and just needs a cleaning. If they are like others I have removed, the clearance between the sensor and the flywheel teeth is critical.
Usually to clean, its a matter of backing off the locknut while holding the sensor from turning. Then gently turn clockwise by hand until the sensor just touches the flywheel teeth while counting the turns. (maybe 2-4?) Then unscrew and clean the dust off the magnetic head.
Replace sensor by screwing in by hand and just touching the flywheel. Then back off to the original starting position & tighten the locknut.
Hmm - the photo above doesn't look like it has a locknut like the Cat sensors I described.