Easiest things is to wash/disinfect the surface before you carve, like give the pumpkin a nice bleachwater bath. Use clean tools & seal the cut edges with petrolium jelly or WD-40.
Long-term you probably could dry it as a gourd to preserve it, but it'll shrivel up a lot and look like shit.
Formaldehyde/pickling would also probably work, but i imagine it'd get all mushy.