I have a 2022 TPI 300 XC. The following are necessary in my experience for TPI's not to foul. I think the TPI setup is poorly explained and it's taken a lot of trial and error, as well as research, to understand how to handle the bike properly. This assumes you have the right plug
1. Follow a good cold start procedure. TPI is "primitive" fuel injection. It's not quite on the same level as normal fuel injection. You have a cold start knob - this is NOT a choke. It must be engaged manually in sync with the ECU running a startup procedure. Even KTM's manual doesn't really explain it well. The way I cold start my TPI is: pull the cold start knob, hit the start button, and let the bike run with the cold start knob pulled out until the tops of both radiators are warm, then disable the cold start knob. DO NOT REV IT WITH THE COLD START KNOB OUT. The ECU runs a different mixture on startup with a TPI and revving it just makes it worse.
2. Set the idle adjustment screw. Your manual or service manual will tell you what RPM the bike should idle at after being warmed up. You don't need the "air screw mod" everyone touts, any issue fixed by the air screw mod is a bigger issue you're just covering up. Use an OBD reader to read the RPM's and try your best to set the idle. Ride it, see how it handles and adjust accordingly.
3. If all that fails, replace your CCPS and start again with the above.
4. If all of that fails, you may need to have your ECU remapped.
5. If all of that fails, check crank seals.