If only it were that simple. Unfortunately this config option is not a property of the AirPods themselves, but to each individual device you own, so you can’t just set it once. You have to go to each device you have on your iCloud account and set “connect only when last connected to this device”.
But it’s even worse than that, because the option is only available to be changed when you have the AirPods connected, meaning you have to go to each device you own, connect your AirPods to them, then go to the menu, find the option for connection mode, and set it to “when last connected”.
And if you forgot a device, it will happily steal your AirPods connection “automatically” the next time it boots up or decided it wants to connect them. And you have to search around and figure out what the hell your AirPods are even connected to.
Did I mention Apple will occasionally release an OS update which changes this setting back to “automatically” again? Now you get to do this whole dance over again, but slowly, as your individual iDevices get rolled-out updates.
(I have 5 devices near my work desk that are potential AirPod connection thieves, this is a huge annoyance to me if you can’t tell.)