One of the reason is that it wasn't pollinated. You need male and female flower to appear at the same time so that bees & ants can pollinate the flowers. If you have only female or male and none of the other sex, the fruit will not form.
Left : male pumpkin flower
Right: Female pumpkin flower.
As for my case, I was wondering how come the flower did not even bloom and it started to dies off. So I monitored my pumpkin flowers and I found out that the fruit flies stung my flower even before they bloom.
this is how the flower looks like after it is stung.
So in order to save my pumpkin flowers, I got to net them up and wait for them to bloom and then hand pollinate them using a brush.
Keep an eye on the flowers and as soon as they bloom, remove the net and hand pollinate it.
If there are fruit flies attacking your flower and fruits, you have to net all of them even after you have pollinated them. Fruit flies can also sting through net, so to be safe use finer nets, thicker nets, or wrap with newspaper and secure with a net.
At the same time you have to trap the fruit flies FAR AWAY from your garden and NOT in your garden. You have to use the fruit fly hormone and build something like this.
Why put it far away from your garden? The smell of the hormone can last for months. they will come from few KM radius and attack all your fruits and vege like brinjals, tomatoes, basically every damn thing in your garden. So get rid of it and also prevent them attacking your pumpkin flowers at the same time. I did this and I manage to harvest 6 pumpkins. Actually there was 7, but the last one dropped off. Maybe the fruit fly manage to puncture the net. But nevertheless the effort pays really well.