The diffraction pattern you see is the square of the Fourier Transform of the aperture function. Now the convolution theorem tells us that the FT of a convolution of A and B is the product of the FT's of A and B. In other words - if you have a diffraction grating made of slits of finite width, you can consider the diffraction pattern to be the pattern obtained from a perfect grating, multiplied by the pattern obtained from a single slit of finite width (a sinc function if you were keeping track).
Googling "diffraction grating convolution" gives https://www.doitpoms.ac.uk/tlplib/diffraction/convolution.php as the first hit. It contains mathematical details and diagrams that go into more depth.
UPDATE
I had not read your question properly - you were asking about the effect of having a "perfect" diffraction grating with a finite width (finite number of slits). Such a grating can be thought of as the product of a "top hat" function and an infinite grating, and the diffraction pattern will be the convolution of the Fourier transforms of those two apertures (this is the convolution theorem "in the other direction").
The Fourier transform of an infinite array of slits is an infinite array of peaks; the FT of the top hat function is (again) a sinc function - but now, since the top hat is wider than the spacing between the slits, a good number of peaks of the sinc function will fit between two maxima in the diffraction pattern; however, their intensity will be the same, regardless of N (as long as N is large enough that the pattern due to the neighboring peak can be neglected). The only thing that will change is the spacing of the peaks.
However, when N is not "very large", it will definitely have an effect. The following plots show this:
The issue here is that there is a degree of constructive interference between the $n^{th}$ peak of one maximum and the $(N-n)^{th}$ peak of the next one... and even some interference from maxima that are further away. Showing this for just N=3 illustrates this point:
Now as you can see, the secondary peaks are a bit asymmetrical, which makes it hard to find an accurate sum for the general case (the N=3 case is a bit easier because peaks of the same order overlap and cancel the asymmetry).
If you can assume the peak is always at the midpoint between the zeros, you can write an expression for the amplitude - it will be the sum of squares of the peaks that overlap. The function describing the basic pattern is
$$f = \frac{\sin^2{n\pi x}}{(n\pi x)^2}$$
The maxima will happen when $nx = \frac32, \frac52, ...$ so the values will be
$$\left(\frac{2}{3\pi}\right)^2, \left(\frac{2}{5\pi}\right)^2, ...$$
Now a given submaximum will have contributions from all the other maxima - you can see that you would have to construct a series summing the contributions. For the nth submaximum when there are N slits, the first four terms would be:
$$\left(\frac{2}{(1+2n)\pi}\right)^2+ \left(\frac{2}{(1+2(N-n))\pi}\right)^2 + \left(\frac{2}{(1+2(N+n)\pi}\right)^2 + \left(\frac{2}{(1+2(2N-n))\pi}\right)^2$$
in reality, only a couple of terms will need to be included, and only when N is quite small. I will leave it up to you to figure out if you can turn this into a closed form (analytical) sum - but given the (false) assumption of symmetry I don't think it's worth the effort.
Evaluating this exactly (from the convolution), the values for the max of the first secondary peak as a function of N are:
N= 3; max = 0.1019
N= 4; max = 0.0690
N= 5; max = 0.0593
N= 6; max = 0.0550
N= 7; max = 0.0527
N= 8; max = 0.0513
N= 10; max = 0.0497
N= 50; max = 0.0473
N=200; max = 0.0472
The value you would expect from the expression above would have the first peak converge to 0.04509 - it doesn't look like that's going to happen as the asymmetry puts the maximum a little bit off to one side.
The Python code I used to generate these diagrams:
# finite grating calculations
import numpy as np
import matplotlib.pyplot as plt
from math import pi
d = 1. # pick a spacing
ell = 0.01 # pick a wavelength
a0 = ell/d # angle where first max occurs .. small angle approximation
ns = 500 # number of angular steps between major peaks
a = np.arange(-3*ns,3*ns+1)*a0/ns # angle in radians
# the pattern for an infinite grating:
f1 = np.zeros(len(a))
f1[0:-1:ns]=1
fig1=plt.figure()
for jj,N in enumerate([2,3,4,10]):
# the sinc function for this number of slits:
f2 = np.sin(N*a*pi/a0)/(N*a*pi/a0)
f2[np.where(np.isnan(f2))]=1 # get rid of the divide by zero in the middle
# compute the convolution
pattern = np.convolve(f1,f2*f2,'same')
ax=fig1.add_subplot(2,2,jj+1)
ax.plot(a/a0,pattern)
ax.set_title('N=%d'%N)
ax.xaxis.set_ticks(np.arange(-2,3,1))
ax.set_xlim([-2,2])
fig1.show()
# show the interference more explicitly for a small number of slits
N=3
f2 = np.sin(N*a*pi/a0)/(N*a*pi/a0)
f2[np.where(np.isnan(f2))]=1
fig1=plt.figure()
ax=fig1.add_subplot(1,1,1)
for jj in range(4):
f1 = np.zeros(len(a))
f1[(jj+1)*ns]=1
pattern = np.convolve(f1*f1,f2*f2,'same')
ax.plot(a/a0,pattern)
ax.xaxis.set_ticks(np.arange(-2,3,1))
ax.set_xlim([-2,2])
fig1.show()