With[{f = Compile[{{point, _Real, 1}, {r, _Real, 0}},
Boole[point.point <= r^2], Parallelization -> True,
RuntimeAttributes -> {Listable}]},
dm3d[n_Integer, r_Integer] :=
f[CoordinateBoundingBoxArray[{-{1, 1, 1}, {1, 1, 1}} Max[1, Quotient[n, 2]]], r]]