The official language of China today is Mandarin.
What were the official language of other dynasties like Han, Tang, Song, Ming? Were there any official language at all?
There are, broadly, three main "languages of the court" for imperial China.
1.5) There is also an Eastern Han Chinese, which is in essence a mixture of Old Chinese and what would become the next "language of the court," Middle Chinese. This was used during the Eastern Han Dynasty, into the Three Kingdoms Period.
Following the 3Ks and the shattering of China in the 16 Kingdoms, and then the Northern and Southern Era, the "language of the court" becomes a far more various answer - which court are we talking about?
Middle Chinese became the de facto official language with the reunification of China in the 7th century under frist the Sui and then the Tang Dynasties. Interestingly enough, though Middle Chinese was indeed the language of the court, it's a tightly-guarded secret that the Tang royal family - the Li Clan - were in fact partially ethnically Turkic, and in private mostly spoke Turkic to one another. Nevertheless, Middle Chinese would remain the language of the court until the destruction of the Song Dynasty by the Mongol Khannate and the establishment of the Yuan dynasty by Kublai Khan.
Finally, Modern Chinese, which came into vogue in the 13th and 14th centuries with the re-establishment of Han Chinese control over the empire under the Ming, and of course remains the spoken languages through the 21st century.
As to how they differ, here's a brief look (taking into account that these represent a "snap-shot" of a single variant of each, and all of the above underwent sizable changes over the course of their respective lifespans, as do all languages):
Let's count to 10!
| Number | Hanzi | Old Cn | Mid Cn | Mod Cn |
|---|---|---|---|---|
| 1 | 一 | ʔi ̯e ̆t | ʔjit | yī |
| 2 | 二 | *njijs | nyijH | èr |
| 3 | 三 | *sum | sam | sān |
| 4 | 四 | sjidh | sijH | sì |
| 5 | 五 | *ŋaʔ | nguX | wǔ |
| 6 | 六 | *C-rjuk | ljuwk | liù |
| 7 | 七 | tshjit | tshit | qī |
| 8 | 八 | priat | pɛt | bā |
| 9 | 九 | ki ̯ʊg | kjuwX | jiǔ |
| 10 | 十 | ȡi ̯əp | dzyip | shí |
I would like to point out some problems with the question you are asking here. I am not an expert on feudal China, but the understanding you seem to have of what language (from an historical perspective) is creates some problems in answering this question.
Where languages are concerned, the picture tends to differ considerably from how we have come to understand the meaning of languages in the modern age. What we today would consider languages (English, French, Chinese, Russian etc.) are usually the product of long-term government regulation and standardisation. Standardisation of language was a process that worked in tandem with the establishment of school systems. As such, both functioned as tools for state building and instilling a sense of nationalism in target populations.
So keeping this in mind, in the only scarcely integrated and inter-connected societies of the pre-industrial era, language could have widely varied between regions within (what would later be considered) a state. The state(-like) structures that did exist usually did not have a ‘official language’ in our modern sense. The bureaucracy/elite might be taught in a certain part of the country (usually the capital province given power concerns). This might result in the ruling elite sharing a language which is then projected onto the wider population. Do note that such an endeavour would require a high level of centralised government, something feudal societies had an inherent lack of.
I hope someone can come along to give you a definite answer, but I hope this insight can help you put this question and the potential answer you might get in perspective.