For alternators there is no real need to know the actual polarity as long as you have an equal number of each. Unlike poles attract so you can easily sort them into one or the other.
If you need to know the polarity then there a few traps you can fall into. Hall probes and sensors will tell you ( if you have them). For the older bar magnets you can suspend them on a fine thread and see which end points north and the end that points north is a N pole.
This is where serious confusion comes in, as the things ought to be called north seeking poles but we are lazy and call it a north pole. For that to point north we have to understand that the earth's north geographic pole is a south seeking pole in magnet terms.
If you use a magnetic compass ( be careful not to demagnetise or reverse it with strong magnets), the end that points north will be a magnetic n seeking pole and will attract the south pole of your test magnet.
Without special equipment, either use an old type bar magnet suspended on a thread or a compass ( preferably with an older and weaker bar magnet) and once you have that magnet marked you can compare with your others knowing that like poles repell, unlike poles attract.
Beware that modern neo magnets are capable of reversing the old steel magnets if you bring them too close so try to establish attraction or repulsion without bringing closer than necessary.
flux