It is he who the students choose as the repersentative of their class.
Is this sentence grammatically correct? If not, why? I would like to know whether the pronoun ‘he’ can be used in this grammar pattern.
The sentence structure is
Subject (it) - Copulative Verb (is) - Complement (he).
The complement should be in the same case as the subject, so "he" is correct.
It's the "who" that's problematic. The structure of the relative clause is
Subject (students) - Active Verb (chose) - Direct Object (whom)
In formal writing, the pronoun should be in the objective case because it stands as an object. In less formal writing, and certainly in casual conversation, people substitute the nominative "who."
"It is he who..." and like sentences are grammatically correct.
This question deals with the case of a pronoun after "to be," which is a complicated subject in English.
Basically, the "traditional" rule is to use a pronoun matching the case of the antecedent before "to be." This rule prescribes usage like "It is he" and "I knew it to be him." The details are complicated and not even well known to most English speakers, so I don't think you need to memorize this rule, because as I'm about to explain, it is often not used anymore.
People still say "I knew it to be him." But in modern usage, "It is he" sounds silly to many people, like the speaker is deliberately trying to sound as grammatically correct as possible. Most speakers would say "It's him" instead. There is disagreement about what to write in extremely formal texts, with some writers favoring "It is he" to try to avoid any hint of informality, and others favoring "It is him" to try to avoid a stuffy or affected tone. (See this question for more information about this: "That was me" vs. "That was I") Despite the general tendency in modern English towards using a pronoun in the objective case after "to be," there are still some structures where the nominative pronoun is fairly commonly used, such as the one you ask about in this question.
I'm not sure why there is a difference between "It is him"/"It's him" (which I'm pretty sure is acceptable for most English speakers, even if some of them feel it sounds slightly informal) and "It is him who..."/"It's him who..." (which I'd guess is not acceptable, or at least sounds highly informal, to most English speakers).
Possibly, the pronoun here is felt to be in some way the subject of the following relative clause, and this feeling causes the objective case to be a less attractive option than in most sentences with pronouns after "to be."
If the preceding explanation is correct, it might also explain why English native speakers are sometimes uncertain of what case to use in sentences such as "Return it to [...] who gave it to you" or "Let [...] who believes in this prophet speak now what he knows" when it's clear to any of them that "Return it to he" or "Let he" would be ungrammatical on their own.