"They prefer buying organic food " in this phrase " buying " us a verb or a noun ...?
Nouns cannot have direct objects; only verbs can.
Buying is a non-finite transitive verb whose direct object is the noun phrase (NP), organic food, which itself comprises an attributive adjective followed by its noun.
The subject of your sentence is third-person personal pronoun They, and the finite verb corresponding to that subject in number is prefer. The object of the verb prefer is the entire non-finite verb phrase buying organic food.
Because the syntactic roles of a sentence’s subject and object(s) must be themselves noun phrases, that means that the subject and object are both NPs — even though neither is a noun! A pronoun is one type of NP, and an ‑ing gerund–participle verb clause is another type of NP. They still aren’t nouns, of course.
Another kind of NP is the infinitive clause, another type of non-finite verb clause that can take an object. So these two are equivalent:
- They prefer buying organic food.
- They prefer to buy organic food.
In both those sentences, the only noun is food. Other NPs there of course are, but only that one noun alone.
To understand how English works, or indeed any human language, you need to go beyond trivial parts of speech that apply to single words only, never to multiword phrases. You need to look at the grammatical roles that the various syntactic constituents are playing, and for that you need a more modern model of language than the baby steps that Διονύσιος ὁ Θρᾷξ (Dionysius Thrax) gave us with his eight iconic parts of speech lo these twenty-one hundred years ago.