Have a pre-climb routine. Such routines have been shown to improve the performances of elite athletes. They give a sense of control, channel attention to the task at hand, and free the mind from extraneous thoughts and worries. Your routine must suit your needs, and will only be effective when you have practiced it until it becomes automatic. Promote positive self-talk.
Flow is a highly focused state.
Our minds, however, have a tendency to drift from this focus, diverting to irrelevant or even negative thoughts. With practice this can serve as a trigger to halt the unproductive thoughts and get you back into the groove. Close your eyes and simply imagine yourself flowing up a climb. You might picture an imaginary climb, such as a perfect hand crack, or the moves on a specific route. Do several sessions a week, devoting five or 10 minutes to each session.