Let \(\mathbb {F}_{q^n}\) represent the finite field with \(q^n\) elements. In this paper, our focus is on determining the number of \(\mathbb {F}_{q^n}\) -rational points for two specific objects: an affine Artin–Schreier curve given by the equation \(y^q-y = x(x^{q^i}-x)-\lambda \) , and an Artin–Schreier hypersurface given by the equation \(y^q-y=\sum _{j=1}^r a_jx_j(x_j^{q^{i_j}}-x_j)-\lambda \) . Additionally, we establish that the Weil bound is only achieved in these cases when the trace of the element \(\lambda \in \mathbb {F}_{q^n}\) over the subfield \(\mathbb {F}_q\) is equal to zero.