If I'm eating an apple, can I say "Baruch atah Hashem elokenu melech haolam" before I decide that the brucha I'm making is a Haeitz, and not Mezonot, Shahakol, or Haadamah?
There is a dispute among the rishonim regarding if one had the intention for the wrong bracha while saying the opening and then realized and corrected his mistake. Some hold that this is fine, and some hold this is a case of doubt (safek) and regarding the laws of blessings we don't say blessings out of doubt (safek brachot lehakel). (Biur Halacha OC 209)
Regarding your case, it seems that ideally one should have the correct intention from the beginning but if one didn't have it then one should not repeat the blessing.