Additional info: If you decide to go inside instead of Sarah, you can't rely on Fawkes helping you out, even if he's a member of your team. Fawkes will refuse to go instead of you, forcing you to sacrifice yours or Sarah's life. It's even funnier when you notice that he actually entered the chamber, but he'll be standing next to you, doing nothing.
First ending - Agree to enter the room and input the correct code
I think this is the most obvious ending for a good character and the best way to solve the problem with the purifier. During the conversation with Sarah agree to take on a suicide mission. Enter the chamber and wait for her to lock you in. Approach the control panel quickly (screen). Use the panel to input three digits - 2 1 6. Finish this off by pressing ENTER (on the console, not on your keyboard ;-)).
Second ending - Agree to enter the room, apply the virus and input the correct code
You'll be doing the exact same things with one exception. Once you've agreed to enter the chamber wait for Sarah to lock you in. Ignore the console for the moment and approach a second panel which can be found in front of you (screen). Press the action key and apply the virus from Raven Rock. Now you may go the console, input 2 1 6 and confirm your request.
Third ending - Refuse cooperation with Sarah / don't give her the code
This is by far the worst solution to the problem. You may consider talking to Sarah to refuse her personally (screen), however it's not necessary. You can wait outside the chamber or once you've agreed to go in and changed your mind. After about one minute (real time) the purifier is going to explode, killing you, Sarah and destroying Jefferson Memorial.
Fourth ending - Send Sarah to the chamber
This should be your choice if you're playing as a bad character. During your conversation with Sarah convince her that she should enter the chamber instead of you. Tell her the correct combination (2 1 6) and unlock a passageway for her with a switch on the wall. Now you must only wait for Sarah to input the code (screen) and you can enjoy the ending. You can also apply the virus to the right console, but you must do this before you talk to her.