By exploiting the connection between scattered F-q-subspaces of F-qm(3) and minimal nondegenerate 3-dimensional rank-metric codes of F-qm(n), n >= m + 2, described in [G. N. Alfarano et al., J. Combin. Theory Ser. A, 192 (2022), 105658], we will exhibit a new class of codes with parameters [m+ 2, 3, m 2](qm/q) for infinite values of q and m >= 5 odd. Moreover, by studying the geometric structures of these scattered subspaces, we determine the rank weight distribution of the associated codes.