See if there is a fusible link in your wiring. It's usually a small (2 - 4") loop of wire that doesn't seem to serve any purpose.
I had one blow on one of our tractors, but it led to an intermittent failure, like you described. It took me months, a new battery and I almost replaced the ignition switch before I found the cause.
I removed the link it and checked continuity across the terminals with a meter & it checked out good, but while I was checking it I flexed the wire just a bit and it went dead, so slight position changes of the wire would cause it to open or close. It was right next to the starter motor on our tractor and in an area that's pretty exposed, so lots of opportunity for jostling. I was able to buy a replacement piece of fusible link wire for about $2 on a Sunday afternoon at AutoZone and reuse the quick attach connector & had it running within 2 hours, once I figured out what was causing the problem.
Hope it's that simple for you!
-Jim