There are certain circumstances where that's allowed. In medical research this approach is usually expressly forbidden, because it leads to hypothesis drift - the idea of flipping through multiple hypotheses until you find one that fits your data in such a way as to make it statistically-significant. Because this makes the hypothesis another variable and changes the truth value, it's generally at the very least frowned-upon.