This is a refined version of a question I have recently posted.
For a prime $p$, let $\varphi_p\colon\mathbb Z\to\mathbb Z/p\mathbb Z$ denote the canonical homomorphism from the integers onto the group of order $p$.
Given an integer $n\ge 3$, what is the smallest $\varepsilon=\varepsilon(n)>0$ such that for any subset $A\subset\mathbb Z$ with $|A|=n$, not contained in an arithmetic progression with the difference greater than $1$, there exists a prime $p$ satisfying $(1-\varepsilon(n))n<|\varphi_p(A)|<n$$(1-\varepsilon(n))n\le|\varphi_p(A)|<n$?
To put it simply, I want a prime $p$ distinguishing between the elements of $A$ ``as much as possible", but not distinguishing between all of them - subject to the assumption that $A$ is not contained in a nontrivial arithmetic progression (see this nice construction by Peter Mueller showing that the containment assumption is vital.).
As an example, $\varepsilon(3)=1/3$: for any pairwise distinct integers $a,b,c$ with $\gcd(b-a,c-b,a-c)=1$ there exists a prime $p$ dividing exactly one of $b-a$, $c-b$, and $a-c$.