Suppose we have a solenoid with two ends A and B. If current at face A is clockwise while at B is anticlockwise. So, A and B act as:-
A as north pole and B as south pole
Current at face A is flowing in a clockwise direction so it acts as "south pole" while at B current is flowing in an anticlockwise direction so it acts as "north pole".