How do you set up a system of ODE's for this problem?

The problem is as follows:

Black and White balls are being created inside an arbitrary volume at rates of $Q_{B}$ and $Q_{W}$. They also disappear from the volume at rates $\lambda_{B}$ and $\lambda_{W}$. Along the surface of the volume are detection machines to which white and black balls attach. These machines are created with rate $Q_{D}$, they disappear(along with all the balls stored in them at any given time)with rate $\lambda_{D}$, and the white and black balls attach to a detection machine with rates $\beta_{B}$ and $\beta_{W}$. Once the number of white balls stored in a detection machine reaches $n$, that detection machine turns off and no more balls can go into it. How do you go about setting up differential equations that describe this system?

Without the condition of a detection machine turning off after $n$ white balls attach, I'd use this system:

$\dot{B}=Q_{B}-\lambda_{B}B-\beta_{B}BD$

$\dot{W}=Q_{W}-\lambda_{W}W-\beta_{W}WD$

$\dot{D}=Q_{D}-\lambda_{D}D$

But I'm not sure how to rewrite the system to account for $n$. Let me know if you need clarification about any parts of the problem. Thank you!

The formulation of your problem is a bit odd since you're talking about discrete events (n balls) but then you write down an ODE which is something you do in the macroscopic limit -- you represent your variables as continuous concentrations.
$\dot{D_u} = Q_D - \lambda_D D_u - \left( 1 - D_o \right) D_u (B + W)$
$\dot{D_o} = \left( 1 - D_o \right) D_u (B + W)$
assuming that your concentrations live on the unit interval ($D_o \in [0,1]$).