This sound very similar to knapsack problem. For your case, I would suppose the following dynamic programming solution.
For each solution (i.e. assignment of students to groups) let us define its "cost" to be the number of missed preferences. (If preferences also have weights, you can also account for them in definition of "cost".)
Now we'll have ans[i][j] to be the optimal cost of assigning the first i students into groups so that the first group has j students (and the second therefore has i-j). We will populate the ans array using dynamics programming. For each i and j consider two cases: you put ith student to first group or to second.
For the first case, the cost will be (cost of putting i-th student to group 1)+ans[i-1][j-1], becase after you put ith student to group 1, you have to assign i-1 students to groups so that 1st group has j-1 students.
For the second case, the cost similarly will be (cost of putting i-th student to group 2)+ans[i-1][j].
So the resulting DP formula is
ans[i][j]=min(cost[i][1]+ans[i-1][j-1], cost[i][2]+ans[i-1][j])
In case j=0 only the second term remains, in case i=j only the first.
This will be not O(N^3), but O(N^2) solution.