Lord Krishna as a child lived in the Vraja region, particularly in Vrindavana, among cowherds. When he was still a child he goes to Mathura, kills Kamsa and thereafter heads over to obtain education under Guru Sandīpani, i.e. while he was still young.
We see Lord Krishna’s company was mainly the cowherd children in Vrindavana. It is only at Sandīpani’s place that he meets the Brahmin, Sudāmā (Kucēla), and they become friends. Śukadeva Goswāmī talks of their interaction in the Śrimad Bhagavata Purana as follows:-
[Śukadeva Gosvāmī continued:] Taking each other’s hands, O King, Kṛṣṇa and Sudāmā talked pleasantly about how they once lived together in the school of their guru. ŚB 10.80.27
Krishna while reminiscing their school days, with Sudāmā says:
My dear brāhmaṇa, do you remember how we lived together in our spiritual master’s school? When a twice-born student has learned from his guru all that is to be learned, he can enjoy spiritual life, which lies beyond all ignorance. ŚB 10.80.31
Further, Chapter 22 of the Dvāraka Khanda of the Garga Samhita says:
“O chaste and devoted one, Shri Krishna, the king of Dvaraka, is my friend. (Part of verse 3) He and I studied in Sandipani Muni's home together. (Part of Verse 4-7)
The above verses are indicative of the two friends meeting first at school. There is no mention of any prior incident of them meeting before gurukula. As stated above, Krishna kept company of cowherds before going to gurukula, whereas Sudāmā was a Brahmin boy. It is also not incorrect to say that they were childhood friends, as when Krishna killed Kamsa and went to gurukula, he was still very young.
So in short, Lord Krishna and Sudāmā were childhood friends who met at school