It sounds like a wiring problem. Turning the front wheel can put pressure on the wiring harness. Some ebikes, particularly with Julet throttle connectors, have had issues with moisture getting into the connector and causing corrosion.
Put the bike on a work stand or just raise the rear wheel off the ground (assuming it's a rear wheel drive). Locate the throttle connector in the wiring harness. Turn on the power and wiggle the connector while twisting the throttle. If it works intermittently, the problem is likely in the connector or adjacent wiring.
Make sure the drive wheel is OFF THE GROUND before trying this!