No, unfortunately there is no such setting. Your best bet is probably to use a 3rd party app with alarm clock functionality. That way it will only play the sound through the headphones and not the speakers. The main disadvantage is that you would need to remember to keep the app launched before you go to bed each time.
Do alarms play through headphones?
Smart alarm clocks are WiFi enabled and able to connect with your Bluetooth® enabled headphones. ... If it doesn't, there are many alarm clock apps that work with both iOS and Android. A few popular apps to play an alarm through headphones are AlarmMon, Good Morning Alarm Clock, and Alarm Clock for Me.
Will an alarm go off through AirPods?
The short answer is yes. When the time of the alarm arrives, it doesn't matter if it's connected to a wired headset or a wireless one. The alarm originates from the iPhone itself and then it's transferred to the AirPods.