Kevin colors three distinct squares in a $3\times 3$ grid red. Given that there exist two uncolored squares such that coloring one of them would create a horizontal or vertical red line, find the number of ways he could have colored the original three squares.
1. **Identify the problem constraints:**
   - We have a $3 \times 3$ grid.
   - Kevin colors three distinct squares red.
   - There exist two uncolored squares such that coloring one of them would create a horizontal or vertical red line.

2. **Analyze the grid structure:**
   - A $3 \times 3$ grid has 9 squares.
   - We need to color 3 of these squares red.

3. **Understand the condition for creating a line:**
   - For a horizontal or vertical line to be formed by adding one more red square, there must be two red squares already in the same row or column.

4. **Consider the placement of the red squares:**
   - Let's denote the grid as follows:
     \[
     \begin{array}{|c|c|c|}
     \hline
     (1,1) & (1,2) & (1,3) \\
     \hline
     (2,1) & (2,2) & (2,3) \\
     \hline
     (3,1) & (3,2) & (3,3) \\
     \hline
     \end{array}
     \]
   - We need to place three red squares such that there are two uncolored squares that can complete a line.

5. **Determine the possible configurations:**
   - For any row or column to have two red squares, the third red square must be in the intersection of the row and column containing the other two red squares.
   - Let's consider the placement of the red squares in a row and column:
     - Suppose we place two red squares in the first row, say at $(1,1)$ and $(1,2)$.
     - To satisfy the condition, the third red square must be in the first column or second column, say at $(2,1)$ or $(2,2)$.

6. **Count the valid configurations:**
   - For each pair of rows and columns, there are 2 ways to place the third red square in the row and 2 ways to place the third red square in the column.
   - There are 3 rows and 3 columns, giving us $3 \times 3 = 9$ pairs of rows and columns.
   - Therefore, the total number of ways to color the squares is:
     \[
     2 \times 2 \times 9 = 36
     \]

The final answer is $\boxed{36}$.