You don’t have to ask them to write it now. You plant the seed now for a letter in the future. Some teachers do letters on a first come, first serve basis.
“Hi teacher Smith, I am really enjoying biology this year. The unit on xyz was particularly interesting. While I know it’s a bit early, I’m starting to think about my college applications. I would be honored if you would write me a letter of recommendation in the fall. I’ll plan to come see you come in September and provide any information you may need from me. Thank you.”