It is known that the Hermitian varieties are codewords in the code defined by the points and hyperplanes of the projective spaces PG(r, q 2 ). In finite geometry, also quasi-Hermitian varieties are defined. These are sets of points of PG(r, q 2 ) of the same size as a non-singular Hermitian variety of PG(r, q 2 ), having the same intersection sizes with the hyperplanes of PG(r, q 2 ). In the planar case, this reduces to the definition of a unital. A famous result of Blokhuis, Brouwer, and Wilbrink states that every unital in the code of the points and lines of PG(2, q 2 ) is a Hermitian curve. We prove a similar result for the quasi-Hermitian varieties in PG(3, q 2 ), q = p h , as well as in PG(r, q 2 ), q = p prime, or q = p 2 , p prime, and r ≥ 4.