How can you prevent yourself from pre-ejaculating almost everytime you get an erection?

You can't. It is natural and individual, you can only manage it by wearing absorbent underwear (like cotton). Getting spontaneous erections usually mostly goes away with age so hopefully won't be as bothersome in a few years.