@LazyReader's answer gives some good advice about the types of paint that can and shouldn't be composted, but you could still try a couple of things if you're unsure what type of paint was used before you chuck the whole pumpkin away:
Wipe the paint off with water
@MJuckes raises a good point that some paints might come off with a bit of water and a light rub with a cloth or rag. This is especially true if it's decorated with the types of paints that kids might use.
Use Vegetable Oil as a solvent
Veg Oil can be used as a light (and biodegradeable) solvent. Depending on the amount and type of paint used, this should be able to remove most of the paint from the pumpkin skin. Simply apply the oil with a rag and some light rubbing.
Note that other household oils (such as Olive Oil) aren't quite as good, but if it's all you have on hand it may be worth giving it a shot.
Scrape/Peel/Cut off excess paint
Use a knife, putty knife, razor blade or potentially even a potato peeler to manually scrape or cut off areas of paint (and likely, some of the pumpkin skin too!), leaving the rest of the pumpkin to be composted properly. Any leftover paint & pumpkin flakes could then be disposed of separately.