Not telling anyone would mean that people would be living their everyday lives for the last 3 weeks, no matter how bad their life is. No one would do anything to stop the astroid, and when it hit, it would most likely take some time to kill all life on earth. People wouldn’t have any time to prepare for the worst and last week of their lives, and it would be your fault.
On the other hand, if you told people they were going to die in 3 weeks, some would panic, possibly making their lives worse. There would also be 2 possibilities if you told everyone. Either the entire human race would come together in a morbid wholesomeness to try to help life survive, or, they would start trying to tie every loose end, and, since you wouldn’t have any reason to worry about the laws, this could result in chaos, including murders, robberies, rape, anything to make themselves happy for the last 3 weeks. Then, the people who want the first possibility would have the worst time of their life, because, being to nice to commit crimes, they would be tortured for the fun of the first group.
If you didn’t tell them, people with good lives would continue living good lives, while people with bad lives would continue living bad lives.
Neither choice would end very well, but when you consider morals, it would be better to tell them. Whatever everyone else decides to do wouldn’t be your fault, you would only be responsible for telling everyone. If you tell them, the chances of the survival of the human race are higher, and you wouldn’t be lying to the whole world.