Normally it should be "2 kg of apples" (note spacing). "2 kg of apple" suggests that "apple" is a "substance" rather than individual fruits. It might be possible in some situations if the apples are not whole but have been mashed up, say.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.
AnonymousOn an unrelated note, why did you use the definite article before "apples"You mean in the phrase "if the apples are not whole"? It is because I was referring to the apples that make up the 2 kg.