can you eat it if it is only slightly ripe
Yes. If it is really green and quite immature, prepare it like you would a summer squash. If it was quite far along but not completely mature, you might be able to treat it more like a winter squash. Without seeing how green it still is, it is hard to guess.
Google recipes for 'green pumpkin'. There are many uses for unripened fruit.