This is a very complex ethical question, which you should think about yourself and consider in terms of your own knowledge and values. But here are some things to think about to get you started.
There are really two questions here, interrelated, but not the same:
1. Is it possible to identify and punish criminals before they commit crimes?
2. Is it ethical to identify and punish criminals before they commit crimes?
Part 1 is largely a matter of time. While neuroscience is currently not powerful enough to make strong predictions about future behavior, we already know certain statistical tendencies, such as the fact that most crimes are committed by young men, people with lower incomes and less education are more likely to commit most types of crime, the fact that lead poisoning increases rates of criminal behavior, and the fact that psychopaths, people with extremely low levels of empathy, are far more likely to commit crimes. (I've linked some studies showing some of the risk factors we know contribute to crime.)
We have various methods of psychological and neurological testing by which we could probably estimate someone's probability of committing future crimes better than chance, but still with substantial uncertainty. So for example if the baseline rate of committing homicide is 50 per million (0.005%) per year, we might be able to show that a poor, uneducated young male psychopath with severe lead poisoning has a much higher, say 1% chance of committing homicide in the next 10 years.
Note that this still means there is a 99% chance this man will not commit homicide. Even if we add up the probability of all crimes he could commit, it's quite likely that with our best neuroscience we could still not do better than predicting a 50% chance of him committing some serious crime at some point in the future.
With this high level of error, it seems obviously unethical to imprison someone for a crime that they still are as likely as not to never actually commit.
But suppose the technology improves over time, as it probably will. How accurate must the prediction be, before we are prepared to use it in crime prevention?
A strict deontologist would probably say that we will never be certain enough, that as long as there is the tiniest chance of error we must grant human beings free will to choose their own fate.
But I am actually quite convinced that no one is really a strict deontologist. It's easy to come up with extreme scenarios in thought experiments which would make just about anyone give up on their moral rules to stop some sufficiently large harm---if you wouldn't kill someone to save 1 life, how about 10? How about 100? How about 1 million? 1 billion?
Deep down I think we are all nuanced consequentialists. Not the sort of naive consequentialist who just adds up the outcomes of this particular action, but a nuanced consequentialist who adds up the outcomes of this action, other actions like it, the precedent it sets, the cultural norms it sustains.
So what would a nuanced consequentalist say? Is there a way to make a society we would want to live in, in which neuroscientists can scan your brain, determine that you have say a 97% chance of committing a crime at some point in the future, and therefore punish you for it?
Many people would say "No", that we would rather live in a world that has occasional murders than a world in which the government has such tyrannical power over our minds. I think that's a legitimate view, and you could argue for it.
But I'd also like you to consider an alternative view which I think is underrepresented. Who said we had to punish them? I sort of assumed that in the above, and most people do. But what if we identified future criminals in order to treat them?
Suppose, for instance, that upon finding this psychopath who has a 97% chance of committing murder in the future, we reprogram his brain in some way---we are, after all, assuming advanced neuroscience technology. Suppose we make him no longer a psychopath; we give him the capacity for empathy he never had. We repair his lead poisoning. We educate him and lift him out of poverty (we should be doing that anyway, right?). Suppose that after all of this we reduce his probability of committing homicide dramatically, from 97% to 1% or even all the way to baseline. Wouldn't that be a good thing? If you were at risk of committing murder, wouldn't you rather get your brain fixed than wait until you kill someone and end up in prison?
Of course, many would disagree with that view as well; a work of literature that argues quite forcefully against it is A Clockwork Orange. But I think it's worth at least talking about. But really the question is: What do you think?