Remove all balls from the game. Make sure all drop targets are reset up and go to switch test mode.
Are any switches being reported as closed?
If not, then manually activate every switch in backwards order from switch 40 down to 1 as shown on the playfield switch layout in the manual.
Document which switches respond with the wrong number.
In reality you need to do the above test twice - once where you press and release each switch, second where you press and allow switches that can stay closed i.e. outhole/trough, drop targets and ball locks to stay closed. One of these particular switches (likely to be a drop target or ball lock) probably has a shorted diode/capacitor and is the reason for the intermittent nature of the issue.
All switches that report wrongly in switch test mode will help build a picture of where your issue is within the switch matrix.