According to Gardening Know How, all types of squash plants grow male and female blossoms together on the same vines. Without both of them, and a few bees and other pollinators to cross between the two, your squash yield would quickly dissipate into nothing. That’s why it’s so important to ensure that you don’t harvest the female blossoms, as they’re the only ones that actually produce squash (via The Spruce Eats). You should also always leave a few male blossoms as well to maintain a balance, as they’re needed to help pollinate the females.
But, how do you tell the difference between a male and female squash blossom? Gardening Know How says that the female blossoms tend to grow in the center of the plant, with a small swelling, or pistil, at the base of the flower. This is the blossom’s ovary, and will eventually grow into a beautiful squash. Male blossoms don’t have this swelling, and tend to grow in higher numbers, with tall thin stalks that grow all across the plant. So, by maintaining a balance and saving your female blossoms, your squash will be able to reproduce. This means you’ll have an abundance of squash, and squash blossoms, to enjoy all season long.
Source: https://www.tastingtable.com/945983/why-you-should-only-cook-male-squash-blossoms/