You should request a letter of recommendation from your supervisor at least 4-6 weeks before the deadline. This will give your supervisor enough time to prepare a thoughtful and detailed letter without feeling rushed or pressured. Be sure to provide your supervisor with all the necessary information, such as the application deadline, the name of the organization or institution receiving the letter, and any specific guidelines or requirements for the letter. Following up with your supervisor a week or two before the deadline is also a good idea to ensure the letter has been submitted on time.