Yes you can. There might be consequences, but that will always be the case. If obeying orders breaks the law, and disobeying orders breaks the law, then you’re a criminal either way. Might as well do what you agreed to do when you joined the military: risk your life to defend the constitution.
“Risk your life” - yeah, and it’s not even that literally extreme. This isn’t the Imperial Guard.
Soldiers take an oath to the constitution, not the president, so all members of the military have the right, and in some cases have the duty, to refuse illegal orders. Source.
“I was only following orders” didn’t work so well in Nuremberg.
UCMJ says otherwise. But in practice, I can tell you from experience that the consequences for any kind of refusal will be treated as mutiny and could cost you the rest of your professional life