Rotation "Z"

Hello Boys!
How do I reset the rotation axis “z” to “0”?!

my code is as follows, but even if I do not rotate in z, however, after some changes its value.

function Update ()
 {

   transform.Rotate(Input.acceleration.x,-Input.acceleration.y , 0 );
   transform.Translate(0,0,2);
   
}

try this :

function Update ()
{

transform.Rotate(Input.acceleration.x,-Input.acceleration.y , 0 );
transform.Translate(0,0,2);
transform.eulerAngles.z = 0;
}