It seems like a straightforward matter of programming.
Finding a single longest line
Suppose you just want to find one line, and you want it to be the longest possible. You can do this in $O(N^2)$ time.
Precompute, at each location $\ell$, the length of the longest horizontal line that starts at $\ell$ and goes to the right. This can be precomputed in $O(N^2)$ time by first filling in the values for the right column of the array, then scanning left-to-right.
Similarly, you can precompute at each location the length of the longest vertical line goes down.
Now you can iterate over all $O(N^2)$ locations, look up the length of the longest line that goes down or to the right from it, and take the max over all of these.
Finding two lines: Naive algorithm
Search over all possible choices of the first line. There are only $O(N^3)$ possibilities ($N^2$ choices for the starting point, 2 choices for the direction, and $\le N$ choices for the length of the line), so you can enumerate all of them in $O(N^3)$ time.
Now the other line must be either entirely above the first line, entirely below it, entirely to the right of it, or entirely to the left of it. Try each of these four cases separately.
Let's focus on the case where the second line is entirely above the first line. That means there is some known $k$ such that the second line must be entirely within the top $k$ rows of the matrix (i.e., within the $k \times n$ rectangle at the top of the matrix).
So precompute in advance, for each $k$, the length of the longest line within the first $k$ rows. Do the same for the last $k$ rows, the right $k$ columns, and the left $k$ columns. This can be done in $O(N^2)$ time: you iterate over $k:=1,2,\dots,N$, and for each $k$, search over all locations in the $k$th row (column) and look up the length of the longest line starting there (using the precomputed arrays mentioned above), and take the max of those $N$ values along with the value for $k-1$.
This means that for each candidate for the first line, you can compute in $O(1)$ time the length of the longest possibility for the second line, which means you can compute in $O(1)$ time whether it is possible to place a second line of equal length.
Since there are $O(N^3)$ candidates for the first line, this leads to an algorithm with running time $O(N^3)$. This is probably already fast enough for the parameter values you list.
Optimization
You can speed up this algorithm to $O(N^2 \lg N)$ time, as follows. Iterative over all possibilities for the starting location of the 1st line. Now do a binary search over the length of the 1st line. For each candidate, you are able to tell whether there exists a way to draw 2nd line of equal length. Keep increasing the candidate length of the 1st line until it is maximized, using binary search to find the maximum.
I wouldn't be surprised if there is a way to achieve $O(N^2)$ time, but $O(N^2 \lg N)$ should already be more than sufficient for your parameters.