Replace your constant 3 by a variable:
Please note that I changed the array to be non-static because having a static array does not make sense here.
class _3DMatrix
{
public int[, ,] m;
public _3DMatrix(int size, int a)
{
m = new int[size, size, size];
for (int x = 0; x < size; x++)
{
for (int y = 0; y < size; y++)
{
for (int z = 0; z < size; z++)
{
m[x, y, z] = a;
}
}
}
}