Bob will win.
This is because it is impossible for Alice to force him to make a non-prime sum in a row.
I will go a step further and say it is always possible to fill the rows so that 6 rows have the sum 19 and 3 rows have the sum 17.
To prove this i will solve it with an easy board and show how every other combination of rectangles can be made from this board with simple transformations and still show the same solution.
Our easy board will have the first two colums filled with 3 vertical rectangles per column.
The rest of the board will be filled with horizontal rectangles for an additional 3 horizontal rectangles per row:
┌─┬─┬─────┬─────┬─────┐
│ │ │ │ │ │
│ │ ├─────┼─────┼─────┤
│ │ │ │ │ │
│ │ ├─────┼─────┼─────┤
│ │ │ │ │ │
├─┼─┼─────┼─────┼─────┤
│ │ │ │ │ │
│ │ ├─────┼─────┼─────┤
│ │ │ │ │ │
│ │ ├─────┼─────┼─────┤
│ │ │ │ │ │
├─┼─┼─────┼─────┼─────┤
│ │ │ │ │ │
│ │ ├─────┼─────┼─────┤
│ │ │ │ │ │
│ │ ├─────┼─────┼─────┤
│ │ │ │ │ │
└─┴─┴─────┴─────┴─────┘
Now each row will have a sum of 15 (for the three horizontal boxes) plus a small amount from the vertical boxes.
I will fill it in as easy as possible:
┌─┬─┬─────┬─────┬─────┐
│1│1│5 0 0│5 0 0│5 0 0│ 17
│ │ ├─────┼─────┼─────┤
│2│2│0 5 0│0 5 0│0 5 0│ 19
│ │ ├─────┼─────┼─────┤
│2│2│0 0 5│0 0 5│0 0 5│ 19
├─┼─┼─────┼─────┼─────┤
│1│1│5 0 0│5 0 0│5 0 0│ 17
│ │ ├─────┼─────┼─────┤
│2│2│0 5 0│0 5 0│0 5 0│ 19
│ │ ├─────┼─────┼─────┤
│2│2│0 0 5│0 0 5│0 0 5│ 19
├─┼─┼─────┼─────┼─────┤
│1│1│5 0 0│5 0 0│5 0 0│ 17
│ │ ├─────┼─────┼─────┤
│2│2│0 5 0│0 5 0│0 5 0│ 19
│ │ ├─────┼─────┼─────┤
│2│2│0 0 5│0 0 5│0 0 5│ 19
└─┴─┴─────┴─────┴─────┘
Now we can already guess where this is going.
3 Transformations are possible/needed:
- substituting 3 horizontal rectangles by 3 vertical rectangles.
This is done easily as we already have our 5s filled in perfectly
┌─┬─┬─────┬─────┬─────┐
│1│1│5 0 0│5 0 0│5 0 0│
│ │ ├─────┼─────┼─────┤
│2│2│0 5 0│0 5 0│0 5 0│
│ │ ├─────┼─────┼─────┤
│2│2│0 0 5│0 0 5│0 0 5│
├─┼─┼─┬─┬─┼─────┼─────┤
│1│1│5│0│0│5 0 0│5 0 0│
│ │ │ │ │ ├─────┼─────┤
│2│2│0│5│0│0 5 0│0 5 0│
│ │ │ │ │ ├─────┼─────┤
│2│2│0│0│5│0 0 5│0 0 5│
├─┼─┼─┴─┴─┼─────┼─────┤
│1│1│5 0 0│5 0 0│5 0 0│
│ │ ├─────┼─────┼─────┤
│2│2│0 5 0│0 5 0│0 5 0│
│ │ ├─────┼─────┼─────┤
│2│2│0 0 5│0 0 5│0 0 5│
└─┴─┴─────┴─────┴─────┘
This can actually be done at any position we wish as long as we have 3 rectangles in a square formation.
- moving vertically
When we have 3 vertical rectangles in a square formation and a horizontal rectangle directly above or below we can switch them.
┌─┬─┬─────┬─────┬─────┐
│1│1│5 0 0│5 0 0│5 0 0│
│ │ ├─────┼─────┼─────┤
│2│2│0 5 0│0 5 0│0 5 0│
│ │ ├─┬─┬─┼─────┼─────┤
│2│2│5│0│0│0 0 5│0 0 5│
├─┼─┤ │ │ ├─────┼─────┤
│1│1│0│5│0│5 0 0│5 0 0│
│ │ │ │ │ ├─────┼─────┤
│2│2│0│0│5│0 5 0│0 5 0│
│ │ ├─┴─┴─┼─────┼─────┤
│2│2│0 0 5│0 0 5│0 0 5│
├─┼─┼─────┼─────┼─────┤
│1│1│5 0 0│5 0 0│5 0 0│
│ │ ├─────┼─────┼─────┤
│2│2│0 5 0│0 5 0│0 5 0│
│ │ ├─────┼─────┼─────┤
│2│2│0 0 5│0 0 5│0 0 5│
└─┴─┴─────┴─────┴─────┘
We dont need to care for the first 2 columns for now as whenever this movement is possible there will always be at least 3 vertical 5-rectangles in the same 3 rows.
- horizontal movement
When we have 3 horizontal rectangles in a square formation and a vertical rectangle directly left or right we can switch them.
┌─┬─┬─────┬─────┬─────┐
│1│1│5 0 0│5 0 0│5 0 0│
│ │ ├─────┼─────┼─────┤
│2│2│0 5 0│0 5 0│0 5 0│
│ │ ├─┬─┬─┼─────┼─────┤
│2│2│5│0│0│0 0 5│0 0 5│
├─┼─┤ │ │ ├─────┼─────┤
│1│1│0│5│0│5 0 0│5 0 0│
│ │ │ │ │ ├─────┼─────┤
│2│2│0│0│5│0 5 0│0 5 0│
│ │ ├─┴─┴─┼─────┼─────┤
│2│2│0 0 5│0 0 5│0 0 5│
├─┼─┴───┬─┼─────┼─────┤
│1│5 0 0│1│5 0 0│5 0 0│
│ ├─────┤ ├─────┼─────┤
│2│0 5 0│2│0 5 0│0 5 0│
│ ├─────┤ ├─────┼─────┤
│2│0 0 5│2│0 0 5│0 0 5│
└─┴─────┴─┴─────┴─────┘
This can be done as often as needed without changing the sums in the rows.
By using these transformations as often as needed we can reach all possible combinations of rectangles.