In this paper, we constructed a class of [Formula: see text]-weight linear codes over [Formula: see text] under the homogeneous weight metric by their generator matrices, where [Formula: see text] and [Formula: see text] The Gray images of some class of these codes over [Formula: see text] are [Formula: see text]-ary nonlinear codes, which have the same weight distributions as that of the two-weight [Formula: see text]-ary linear codes of type SU1 in the sense of [R. Calderbank and W. M. Kantor, The geometry of two-weight codes, Bull. London Math. Soc. 18(2) (1986) 97–122]. Also, we obtained the minimum distance of the dual codes of the constructed codes. Further, we discussed some optimal linear codes over [Formula: see text] with respect to Plotkin-type bound from the constructed codes when [Formula: see text] Furthermore, we investigated the applications in strongly regular graphs and secret sharing schemes.