Botanically speaking it is fruit. Culinarally speaking, it is a vegetable.
I've seen these questions asked over and over on Ask. Here is the deal:
Botanists do not classify anything as a vegetable. When they use the term "fruit", it has a different meaning than the way we use the word fruit. Their definition also includes plants that aren't even edible. They don't use the term vegetable because the word has no scientific meaning. It is a generic term. In other words, carrots, celery, potatoes, broccoli, onions, etc. are not vegetables to a botanist. Nothing is.
So, when you ask if something is a fruit or a vegetable you're using two sets of criteria. Fruit should be used in the generic sense of the word when comparing it to vegetables. Culinarians define vegetables as savory and fruits as sweet. Pumpkins are used both ways. Pumpkin pie is sweet and pumpkin soup is savory.
Mushrooms are considered to be a vegetable even though botanically they are a fungus.