He told the children they were not alone, saying it was “very sad” that on a visit to Kyiv last month he saw no youngsters playing outside.
“When your president showed me around Kyiv last month, the absence of children and young people on the streets and in the parks made me feel very sad,” he wrote.
He went on to say that Ukrainian children must bear two things in mind: that they should be “immensely proud” and that they have “millions” of friends around the world.
“Since the invasion, many of you have been forced to flee your homes. You have left behind family, friends, pets, toys and all that is familiar, seeking refuge in underground stations, distant cities, even other countries. I cannot imagine how difficult this year must have been for you.”
Mr Johnson said the children should be proud of their country, their parents, their families, their soldiers and, “most of all”, themselves.
“Many of you have seen or experienced things no child should have to witness,” he wrote.
“Yet, every day Ukrainian children are teaching all of us what it means to be strong and dignified, to hold your head high in even the toughest of times. I can think of no better role model for children and adults everywhere.”
The prime minister said the children may be separated from their friends at home but they have “millions of others all over the world”.
“We fly Ukrainian flags from our homes, offices, churches, shops and playgrounds, even from my own roof in Downing Street, where the windows are filled with sunflowers drawn by British children,” he wrote.
“Our young people are painting your flag in their classrooms and making blue and yellow bracelets in support of your country.”
“I believe, like your president, that Ukraine is going to win this war. I hope with all my heart that, one day soon, you will be free to return to your homes, your schools, your families,” he said.
“And whatever happens, however long it takes, we in the UK will never forget you, and will always be proud to call you our friends.”
The talks followed the revelation by Ms Truss, the foreign secretary, on Friday that she wants Moldova to be “equipped to Nato standard” so it could defend itself against potential Russian aggression.
In an interview with The Telegraph, she said Britain was discussing the prospect with its allies, given President Vladimir Putin had been “clear about his ambitions to create a greater Russia”.