Recently, I had a similar problem that was hard to find.
It was one of the terminals on one of my coils. Dam thing was broken inside the coil & making intermittent contact.
Then on the way back to Brisbane from Sydney, after visiting the Hunter Valley "Norton Day".........One of my "well worn" slides had two chunks of the front of it misssing. Chewed up & spat out of the engine I'm guessing. Anyway the the engine got me home ok, as on the highway with the throttle opened up, the engine ran ok.
Hopefully your problem is simpler. As norbsa suggested, start at the plug & work back.
You wouldn't have an air leak at the carby would you ?