It depends on the meteorite being studied. When a meteorite is discovered, scientists can study it and compare it to moon rocks. They can compare the composition and makeup of the rock with the moon rocks and they'll find that the meteorites bear a strong resemblance, thus making it
probable that it came from the moon.
For Martian meterorites, they can look at a few other things. You can first check to see if it's
igneous. That indicates that it might have come from a place with molten rock and it solidified at some point. That in turn indicates that this came from a planetary body. Now that you've established it came from a planet or a moon and not the asteroid belt, you examine other things. The meterorite might have gas bubbles in it, so you compare the composition of the gas with your knowledge of the atmosphere of other planets. In the case of ALH84001, they may have seen that the rock had lots of Fe, like Mars, and that it had gas bubbles which matched what previous landers on the planet may have observed. They then come to the conclusion that the meteorite in question is
probably from Mars.
As for your other questions, the wikipedia article rightly points out that ALH84001 might have been contaminated. That's why you see articles like this peppered with maybe and probably every few words.