Step 1: Condition for extremum.
For a function to have an extremum at
\[
x=\frac{\pi}{3},
\]
the first derivative must be zero at that point.
So,
\[
f'\left(\frac{\pi}{3}\right)=0
\]
Step 2: Differentiate the given function.
Given,
\[
f(x)=a\sin x+\frac{1}{3}\sin 3x
\]
Differentiating with respect to \(x\),
\[
f'(x)=a\cos x+\frac{1}{3}\cdot 3\cos 3x
\]
\[
f'(x)=a\cos x+\cos 3x
\]
Step 3: Substitute \(x=\dfrac{\pi}{3}\).
Now,
\[
f'\left(\frac{\pi}{3}\right)
=
a\cos\frac{\pi}{3}
+
\cos\pi
\]
Using
\[
\cos\frac{\pi}{3}=\frac{1}{2}
\]
and
\[
\cos\pi=-1,
\]
we get
\[
a\left(\frac{1}{2}\right)-1=0
\]
\[
\frac{a}{2}-1=0
\]
\[
\frac{a}{2}=1
\]
\[
a=2
\]
Step 4: Verify the extremum condition.
The second derivative is
\[
f''(x)=-a\sin x-3\sin 3x
\]
At
\[
x=\frac{\pi}{3}
\]
and
\[
a=2,
\]
we get
\[
f''\left(\frac{\pi}{3}\right)
=
-2\sin\frac{\pi}{3}-3\sin\pi
\]
\[
=
-2\cdot \frac{\sqrt{3}}{2}-3\cdot 0
\]
\[
=-\sqrt{3}
\]
Since
\[
f''\left(\frac{\pi}{3}\right)\neq 0,
\]
the function has an extremum at
\[
x=\frac{\pi}{3}
\]
Step 5: Final conclusion.
Therefore,
\[
\boxed{2}
\]