I just posted on this subject in a different forum, so I'll just quote myself, here:When you select more than one ship, note that one of them will be the "primary selection", and have a slightly brighter selection square around its icon.
If you hit TAB, the primary selection will cycle through all of the ships you have selected.If you form a fleet from your selection, the primary selected ship will be the flagship.
The way I usually do it is just to select the ship I want to be flagship, hold down shift, add all the other ships I want in the fleet, and hit the form fleet button.
If you somehow get it wrong, you can fix it simply by selecting the fleet, hitting TAB to cycle to the ship you want to be flagship, and hitting the form fleet button again.
Which is a good option for a small fleet, but if you have a couple of hundred ships in the fleet, tabbing through them can be a pain in the arse. And Shift selecting them all doesn't always select all the ships as I found out about a week ago. There needs to be a button somewhere to allow you to form the fleet and then individually select the fleet leader (if you want to) rather than having to mess around with tab and shift.