Sure, but not to kill people, but to save people. If you eat meat, you won't have this ethical problem. Ethics is also an important course. My first ethics class was to watch the Japanese do various experiments with China people, which was against ethics.
Experiments on some animals, including dogs, are aimed at saving human lives.