Fans generally put him at around 14, matching Sonic, but that number is an inference rather than an official statement.
The reasoning is simple: Metal Sonic was built by Dr. Eggman as a robotic duplicate of Sonic, so his apparent age tracks his template. Whether a machine has an age at all is a fairer question, and the series has never treated his construction date as something worth specifying.
What is consistent is his purpose — to prove the original obsolete — and his most memorable appearance remains the CD-era race where he steals Sonic's form and challenges him directly. That rivalry, more than any number, defines the character.