I had a similar problem on my TF 1/5 P-51 with Robart Electrics. Gear worked fine on ground without engine running. With engine running the gear would not retract. Turned out to be a 1/8" hole worn in the ignition metal braided cable where it pasted through the firewall. Replaced ignition and the problem was fixed.
Ralph White