B might make sense, but it's not idiomatic. It's true that pair is a count noun in that you can have one pair or two pairs. But when you are referring to both shoes of the pair, we use a plural pronoun.
So, it's take them away because both shoes are dirty.
If only one shoe of the pair of shoes is dirty, we wouldn't normally say this pair of shoes is dirty but this shoe is dirty or the right/left shoe (of this pair of shoes) is dirty. In that case you're talking about one shoe so use it: Take it (the dirty shoe) away.
Again if only shoe was dirty and you said Take them away, you might get a puzzled look from whoever you're talking to, because they would associate it not with one pair but with one shoe; thus they might wonder why you're saying to take only one dirty shoe away if both are dirty. Yes, it might "make sense" to say Take it away and have it refer to the pair of dirty shoes, but that's not how native speakers normally use and match the pronouns with the nouns in this context.