In the TOS Book The Kobayashi Maru Cadet Montgomery Scott fails the Kobayashi Maru and is moved from the Command Stream to the Engineering Stream.
"Fail" is a nuanced word however.
Scott uses his mathematical and engineering know howknowhow to destroy wave after wave of attacking Klingon vessels. One of the techniques he uses is known not to work in practice, but because theoretically it should, the computer lets him use it. He "fails" the test for contempt and is moved to the Engineering Stream he really wants to be in.
The linked book is a really interesting read, with 4 different takes on what passing the Kobayashi Maru actually means. Apologies if I've mis-remembered anything as it's been 25 years since I read it.