It doesn't quite fit your description, but could it be The City Under Ground?
I re-read the book now, writing this answer while I read. I thought it might be this book when I started, but now that I've finished it I'm not so sure anymore. I'll post the answer anyway just in case you're mixing two different books together.
Trying to find this book. I think the author's surname begins with M
The author is named Suzanne Martel.
it was possibly published in 1980s.
First published in French as Quatre Montréalais en l'an 3000, the book was published in English in 1964 as The City Under Ground; a 1966 revised French edition called Surréal 3000 was published in English in 1982, under the title The City Underground (note that there's no space in the revised title) according to Wikipedia (although I can't find much information about this edition).
Story starts in underground city, focus on two students.
The story starts in Surréal, a highly advanced underground civilization. The beginning of the book focuses on two 12 year old friends and class mates, Luke and Eric.
There is a war going on between the "reds" and the "greens". Two students are enlisted to different units.
Not quite. The students play a sport/game called "robot-balloon" in school, on one "red" and one "blue" team. Luke and Eric's brothers, Paul and Bernard, play on the red teamm.
It is revealed that the "reds" and the "greens" are the two army units - the city is so vast that they don't realize they are fighting each other.
This doesn't quite fit either. Bernard, Eric's brother, works for the city's Power Center to find an electricity leak that threatens to shut down the city. He describes himself as a soldier reconnoitering while crawling through conduits. He discovers that the elctricity is being siphoned by another underground faction, short ape-like humans.
One student is killed.
Bernard cuts the apes' power line and caves himself in with them to cut off their access to Surréal and the power; he is assumed to be dead for several chapters. Luke gets lost in the woods above ground at night and breaks his leg, while wolves howl around him. Neither of them is actually killed, though.
Other befriends a girl and together they discover the tunnels leading up. They escape the city and climb up.
Also not quite. Luke escapes from the underground and encounters a girl, Agatha, who is living above ground in a society of hunter-gatherers. His brother, Paul, also climbs out of the city and finds him; he befriends a blonde girl from Agatha's society.
They are chased by wild animals and escape the island.
Luke and Paul are chased by a puma. There's no island, however.
The following parts don't fit at all. Could you be conflating two different stories?
School tests them to find their new job (not City of Ember).
They find an abandoned "refreshment and entertainment centre" and are almost killed by the cleaning robot.
They move further up in the tunnels and discover an amusement park also abandoned and underground - they keep climbing until they reach sunlight. I think they discover that they are on an island and must find a way to get across the channel.
The arrive on the mainland. There they discover that solar flares have destroyed civilisation, but NASA scientists and their families took shelter centuries ago and built the first underground city, and their descendants built the second deeper city as the flares got worse. The leaders still live near the surface and monitor the lower city to find those who may help restore civilization.