Don't impersonate your manager, even if he asks you.
But he has also asked me to use his credentials to take a mandated exam, so that it appears that he was the one taking the exam.
Your company most certainly has a policy against this kind of impersonation, which means both of you would be violating the company policy. Some companies are also known to perform "compliance auditing" by having a person of authority tempt an employee to violate a policy. If your manager is doing this as part of such an audit, then you would fail the audit.
Moreover, your company has ruled that this exam is mandatory, and letting one person take exams on behalf of multiple people reduces that rule to a farce. The company probably has a good reason for making the exam mandatory, so bypassing that can create problems later. For example, the manager could be deputed to work for a client, and they assume that he has a certain level of competency in this subject, as seen from his score in this exam.
How can I tell tell him "No" to that without making him upset or angry.
This is one of the few scenarios where you should not do what the boss asks. However, you should respond with a "positive No" by not only providing a good reason, but also offering alternatives.
Ask him why he cannot take the test, and suggest ways to help him solve that problem. If he finds the material too hard to follow (due to not having the relevant background, for example), offer to teach him or provide self-study material. If he doesn't find the time to study, offer to take up some of his less critical responsibilities for a few days. If you are not senior enough to do that yourself, suggest that he could consider assigning those to a senior team member.