It is preferred for the imam to stand in the centre of the rows and the people closest to him should be the people of intellect and understanding.
Elaborating more on this, we we cite what Sheikh Sayyed Sabiq states in his well-known book, Fiqh Us-Sunnah: It is preferred for the imam to stand in the centre of the rows and the people closest to him should be the people of intellect and understanding. Abu Hurayrah reported that the Prophet (peace and blessings be upon him) said, “Let the imam stand in the center, and close the gaps in the rows” (Abu Dawud).
Ibn Mas`ud reported that the Prophet (peace and blessings be upon him) said, “Let those who are prudent and sedate be near me, then those who are next to them, then those who are next to them, and beware of the tumult of the market place” (Ahmad, Muslim, Abu Dawud, and At-Tirmidhi).
Anas said, “The Prophet loved that the emigrants and helpers stand next to him so that they would learn from him” (Ahmad and Abu Dawud). The wisdom behind having such people close to the imam is that they can correct him if he makes a mistake and it is easy for the imam to appoint one of them in his place if he needs to leave.