Boogers are basically just dried up mucus inside your nose so to prevent boogers from forming inside your nose you need to blow the mucus out of your nose.
Also you should use a saline solution to clean your nostrils out often which also remove the mucus and prevent it turning into boogers.
Dust, pollen and viruses can cause mucus to form in your nose which can lead to boogers so you'll need to keep your nose clean and try prevent allergies if you have them.
Using nasal spray can also help with preventing boogers in your nose.
Always wash your hands too after blowing your nose or picking your nose to prevent the spread of germs.