Yes, provided the fighters have a place to land when the attack is made, you can choose the carrier as a casualty before the fighters. Though in either case, whether you win or lose, if the surviving fighters don’t have a place to land after combat, they will crash into the sea. The important point is that when combat begins all combatant fighters must have a viable place to land. The ability to move fighters off territories to land on carriers, or off carriers to land on territories, may allow you to bring more fighters into the battle than the carriers alone would seem to allow, this is called maxing movement, but you can’t suicide or kamikaze fighters outright. In other words, you have to have a place for them to go at the start of the attack, but not necessarily once the attack is underway and you are actually taking fire. There is some flexibility in choosing casualties, once combat begins… so if you know it is an all or nothing flight, it may make sense to choose the carrier before the fighters.
There is one situation where choosing the carrier first can be crushing though, if you are defending, and the attacker retreats after a strafe, if your fighters have no carrier or territory to land on they will crash into the sea at no cost to the attacker.
On the older boards there were mechanisms like counters to track the exact movement left for individual aircraft. But I think on these latest boards, the attacker is just assumed to always take casualties on the fighters with the least movements first. For the defending carrier based fighter it doesn’t matter, if the deck is destoyed they have to land in a territory adjacent to the sz where the combat took place. Otherwise they crash