Simply snip off the main stem at any point below the growing tip. Cut straight through the stem, not on an angle, so as to leave as little surface exposed as possible, reducing the risk of infection You can cut off as much or as little as you want, as long as some branches with growing tips remain.
The plant may sulk for a day or two, but as long as other things aren't causing it stress it will soon put all it's energy into growing what is left.
You can continue topping the plant as many times as you like during vegetative growth, but it's not recommended after week 1-2 of flowering. Stress during the later stages of the plants growth can induce it to grow male flowers.