I think it's a general problem that Duolingo often uses isolated sentences without context. The dative case is used here if the preceding sentence used the dative case.
E.g. Person A: "Das hat IHM sehr geholfen (That helped HIM a lot)".
Person B: "Nicht IHM, sondern MIR! (Not HIM but ME!/It didn't help HIM but it helped ME!)."
Actually, if you had to translate the English sentence "Not him, but me" without context, all the four German cases would be correct. Without context, it's impossible to tell what the preceding sentence looked like.
Ist er das? - Nicht er, sondern ich. (Is that him? - Not him, but me.)
Hat Maria ihn gesehen? - Nicht ihn, sondern mich. (Did Maria see him? - Not him, but me.)
Hat Maria ihm geholfen? - Nicht ihm, sondern mir. (Did Maria help him? - Not him, but me.)
Werden sie seiner gedenken? - Nicht seiner, sondern meiner. (Will they commemorate him? - Not him, but me.)
@caroltaylor23: The point of my post was not to discuss the intricacies of prescriptive vs. descriptive English grammar, but to demonstrate that the context-free English sentence "Not him, but me" could be translated by using any of the four German cases. Correct me if I'm wrong, but I think we can agree that a sentence such as "It's me" is commonly used in English. It's possible to encounter such as sentence in real life, and such a sentence would have to be translated using the nominative case in German (in German, there is no alternative to the nominative case here, colloquial or otherwise). It's one of the few instances where an English object pronoun can be translated into the nominative case in German. As far as I can tell, this ONLY works with linking verbs. Whether traditional English grammarians, who try to apply the rules of Latin grammar to English, consider a sentence such as "It's me" right or wrong was not my point.
Of course you are right, caroltaylor23, about the nominative case. However, much as I hate to admit it (myself a strong partisan of the correct use of the predicate nominative), we do frequently hear "Is that him?" and the like. So it would certainly be understood by English speakers, though it is not considered technically correct grammar. However, here is a Lingot, and a ticket to the grammar policemen's ball, if you'd care to go with me. ;-)
"Actually, if you had to translate the English sentence "Not him, but me" without context, all the four German cases would be correct. "
Except that it would be COMPLETELY unclear to the English speaker that it was in the dative, (in English, the dative would be "not to him, but to me") and unclear why it should be in the dative.
Which is why Duolingo really needs to provide more explanation for us poor English speakers.
I disagree with your example of the nominative. You used the linking verb "is" which requires the use of nominative pronouns. Even though it sounds weird in English, the correct question/answer pair would be "Is that he? Not he, but I." None of your other examples use linking verbs so they're all ok, but you'd need a non-linking verb to make the nominative example work.
No, aber doesn't work here because the meaning of the sentence is more precisely: "not him, but (instead) me" or "not him, but (rather) me," and German uses a different word, sondern, for this meaning of but.
It may help to notice that this is a case of a "correlative conjunction" where multiple words work as a pair or group to connect two parts of a sentence together. Consider "either A or B" and "both A and B" as common examples in English.
Here the correlative conjunction is "not A, but (instead/rather) B," which in German is "nicht A, sondern B." Sondern is only used in coordinating conjunctions, so watch out for a "not" preceding a "but" for when to use sondern instead of aber.
The German sentence is clearly in the dative. I therefore answered 'Not for him, but for me' which was also accepted (as apparently would 'Not to him, but to me').
I fail to see how 'Not him, but me' (which strictly is accusative) could be correct here. It may be idiomatically appropriate but dative is dative......