This is, almost verbatim, what I wrote to a couple of professors in asking for recs for med school:
Dear Prof. X,
[Insert personal note about something we had in common.]
I am writing because I have been spending much of this summer planning for the upcoming school year, and I'm beginning to put together my medical school application materials for the spring. I learned a great deal in your course, and I am very thankful for all of your help with my questions. Do you feel that you would be able to write a letter supporting my application to medical school?
If so, I am happy to send along my CV, transcript, or any other information about myself that would assist you in writing the letter. There is an official form that the UMass pre-medical adviser uses that I can send or bring to your office, too. I look forward to hearing back from you!
Best,
My Name
Hope that helps.