A student who asked me to write a rec letter seems to have committed academic dishonesty in my class, what do I do? A student (let's call them A) in my class that I just finished teaching asked me to write them a recommendation letter. I said yes, and the first deadline is Dec 15, as they often are (FYI, I'm writing this post on the very early morning of Dec 14).
Unfortunately for the student, as I was grading the final exam, I noticed that A and another student (call them B) seem to have exactly the same wrong answers (their wrong answer was pretty unusual, and in my class of 100, they were the only ones to have these wrong answers).
I've actually been suspicious of B for a while, as B kept coming up with the correct answers without actually being able to justify their steps, and in fact, their work was often wrong up until the final answer.
Upon comparing A and B's exam papers, A's solutions were more or less clear, and I'm sure that A worked it out themselves. B, on the other hand, has solutions that are more or less like A's solutions, but there are so many critical typos and mistakes in notation (showing that B has no idea what is going on in the course) that it should be impossible for B to arrive at the correct answer. I think the errors were introduced because B was sneakily trying to change some letters and such to a different letter, and changing a sentence structure here and there, etc.
So, I suspect that A is actually a decent student, but for whatever reason, A let B copy their answers for the exams in the course (there were 3, all 3 exams were strikingly similar).
I'm planning to submit this case for an investigation, but this takes a while, possibly longer than a semester. My questions are:

Should I still write the recommendation letter? On one hand, if A turns out to be innocent (not possible in my heart, but innocent until proven guilty) then I'm screwing them over by declining to write a letter so close to the deadline. On the other hand, if A cheated, then since I was aware of this before writing this letter, I don't want to not mention it.
How would you confront the student?
You agreed to write this letter, and it is due tomorrow (!). Reneging on your promise would effectively torpedo the student's applications, as they are very unlikely to find another recommender on one day's notice. Given that you haven't even confronted them yet (much less convicted them), this would be altogether unjust. (Clearly, your dilemma would be very different if this incident had come to light a month ago.)
Given this timescale, I suggest the following:

Write the letter without any mention of your unproven suspicions.
Confront the student.
If the student confesses or is convicted, you could then consider contacting the programs to withdraw or amend your letter. This is a natural, just, and foreseeable consequence of A's decision to cheat in a class taught by their recommender.

One other thought: consider doing #2 ASAP -- you could ask the student if they are available for an urgent, important call regarding your letter of recommendation (that should get their attention). You can then confront them and also explain how this will (not) affect your letter. This conversation has a few possible outcomes:

You proceed as above. Indeed, I recommend writing the letter before having this conversation precisely so that your letter is not (even unconsciously) affected (as even innocent students may react poorly to serious accusations).
They withdraw their request for a letter. You certainly shouldn't pressure the student to go this route -- I wouldn't even bring it up. But it's possible the student will say that they prefer not to use your letter given the accusation; in this case, you should respect this.
They confess to cheating, at which point you can either rescind your offer to write the letter, or you can agree to write a letter that reflects this incident.

Note, if you do confront the student ASAP, you must be careful not to pre-empt the judicial process, nor to create an abusive, blackmail-like situation. Assure them that you have written a positive letter that does not mention your suspicions, and that you will not rescind or amend your letter until/unless they are formally convicted. Despite your best efforts, A will doubtless still be stressed; accusations of cheating are always stressful. But being transparent and giving A as much agency as possible is the best one can reasonably do under the circumstances.