Are P-hacking and hypothesising after results are known considered misconduct in academia?
The Declaration of Helsinki was updated in 2013 to "mandate" that research involving human subjects must be pre-registered. While not perfect, pre-registration prevents many of these statistical manipulations. The idea of pre-registration is that publicly stating your hypotheses and the details of how they will be tested in advance reduces questionable statistical practices. For example, changing the number of subjects, the inclusion/exclusion criteria, or the statistical model are not allowed.

From my understanding, failure to comply with the Declaration of Helsinki would be considered unethical in Medicine, while in other fields the pre-registration aspect is being actively ignored. For example, articles are now being published with disclaimers like "this research was conducted in accordance with the 2013 Declaration of Helsinki except the study was not pre-registered".