There are many things going on during a trials. You have to remind yourself to take it one obstacle at a time, one section at a time. Very easy for the mind to wander to the `thing` down the road you dread instead of what`s right in front of you. Slow down a little and pay attention to every section. (Even the easy ones) The stalling is usually more mechanical than mental. Idle too low, clutch dragging a little more, Rear brake pedal adjusted too high or not enough play. Take the time before the event to make sure the air/idle screws are set right for that day. Each day the weather can effect proper carb set-up just a little.
The little points here and there is what separates the guys that always win and the ones that could have. You have to find that point that keeps you sharp. Find that `zone` that you ride the best. I find it best to ride by myself with no distractions. Many riders ride better slow, taking their time and truly finding better lines by watching all the competitors. Good Luck!