probability group students to maximize expectation
You can solve the problem via integer linear programming by using the following set partitioning formulation. Let $S=\{1,\dots,3n\}$ be the set of students, and let $$T=\{(i,j,k)\in S\times S\times S: i < j < k\}$$ be the set of triples of students. For $(i,j,k)\in T$, let binary decision variable $x_{i,j,k}$ indicate whether triple $(i,j,k)$ is assigned to a group. If $x_{i,j,k}=1$, the pass probability for that group is \begin{align} P_{i,j,k}&:=p_i p_j p_k+(1-p_i) p_j p_k+p_i (1-p_j) p_k+p_i p_j (1-p_k)\\ &=p_i p_j + p_i p_k + p_j p_k - 2 p_i p_j p_k. \end{align} The problem is to maximize $$\sum_{(i,j,k)\in T} P_{i,j,k} x_{i,j,k} \tag1$$ subject to \begin{align} \sum_{(i,j,k)\in T:\\ s\in\{i,j,k\}} x_{i,j,k} &= 1 &&\text{for $s\in S$} \tag2 \end{align} The objective function $(1)$ is the expected total score. Constraint $(2)$ assigns each student to exactly one group.
Numerical experimentation for small $n$ and uniformly distributed $p_i$ confirms your intuition of two large and one small probability per group. In fact, the smallest probability appears with the two largest, the next smallest with the next two largest, and so on. For example, if the students are relabeled in increasing order of $p_i$ (without loss of generality), then $n=6$ yields groups $$\{\{1,17,18\},\{2,15,16\},\{3,13,14\},\{4,11,12\},\{5,9,10\},\{6,7,8\}\}.$$
Update: here is a small counterexample with $n=2$. Take $p=(0,0,0.1,0.6,0.8,0.8)$. Then groups $\{\{1,2,3\},\{4,5,6\}\}$ yield an expected score of $0.832$, while groups $\{\{1,5,6\},\{2,3,4\}\}$ yield a smaller expected score of $0.7$.